Hide Forgot
Description of problem: Current behavior of foreman-debug, specifically task export might not be sufficient when we are looking for performance issues. I. e. if I can see error message: "[E] Required lock is already taken by other running tasks." and I need to check the actual task which had the locks and this task finished successfully, it will not be included later, when the foreman-debug performs task export script. Version-Release number of selected component (if applicable): Satellite 6.X How reproducible: Just run foreman-debug and look for successful tasks in the task export Actual results: Successful tasks are missing in the task export Expected results: Successful task will be included in the task export Additional info: Current implementation: #foreman-tasks export if hash foreman-rake 2>/dev/null; then echo "Exporting tasks, this may take a few minutes." tasks_filename=`foreman-rake foreman_tasks:export_tasks 2> /tmp/tasks_export.log | tail -n 1 | awk '{print $2}'` copy_files $tasks_filename add_files /tmp/tasks_export.log fi Proposed modification: #foreman-tasks export if hash foreman-rake 2>/dev/null; then echo "Exporting tasks, this may take a few minutes." tasks_filename=`foreman-rake foreman_tasks:export_tasks tasks=all days=14 2> /tmp/tasks_export.log | tail -n 1 | awk '{print $2}'` copy_files $tasks_filename add_files /tmp/tasks_export.log fi Because there might be a lot of tasks, I believe it will be good to limit the age of tasks included in the task export. Therefore I'm proposing 14 days as I think it should be more than sufficient.
Created redmine issue http://projects.theforeman.org/issues/14487 from this bug
Upstream bug component is Content Management
Upstream bug component is Tasks Plugin
I suggest the search-based param to the export, similar as we have in cleanup task https://github.com/theforeman/foreman-tasks/blob/master/lib/foreman_tasks/tasks/cleanup.rake#L6 It would be customizable by an environment variable, with some sane default, that we can discuss here.
The export task can already export successful tasks but it doesn't do so by default. See: https://git.io/vrCR2 https://git.io/vrCRV
I do like the idea of removing 'tasks' and adding a 'filter' option but I worry about backwards compatibility (ie is anyone using 'tasks'?).
We can keep the ENV['tasks'] there, maybe with deprecation with suggestion to use the filter instead
Upstream bug assigned to inecas
Upstream bug assigned to daviddavis
The PR that fixes the issue is available https://github.com/theforeman/foreman-tasks/pull/186
Now, to do a foreman-debug that would include all tasks (and not just errorred ones), you'd do: export TASK_SEARCH='' foreman-debug
I don't think we should include all the successful tasks by default there. @Marcel: Would the solution, where one would specify the TASK_SEARCH to get something more work for you: foreman-rake foreman_tasks:export_tasks TASK_SEARCH='' The TASK_SEARCH accepts the search field in the same format it does in the tasks page in the UI. It should be also possible to do it via this approach export TASK_SEARCH='' foreman-debug For this part, we would need to pull this change in https://github.com/theforeman/foreman/pull/3534 to propagate the env variables to the foreman-rake.
+1 to the suggestion above. We should keep the behavior the same for the default but offer a route to exporting all the tasks or different selections based on an variable. By default, exporting all tasks can be quite large and greatly increase the size of foreman-debug's output.
@Ivan: Your suggestion has a point and it might be beneficial for us. But I do not know if the effort put into modifying of the code would be necessary when we can use the foreman-rake as it is. I was pointing on this because a lot of customer is giving us sosreports / foreman-debugs which includes the task export with all failed/pending tasks. However, it happened to me many times, that I needed to see also the successful tasks since they were blockers for the failed one, ore for deeper debugging and I have to ask the CU specifically for it again and again which is just stalling us in the work which could be done automatically. We also do not need to include all the tasks since the time the satellite was installed, just few days in the past, say 7 or 14 as I do not expect that there will be reason for going more into the history and if so, we can again use the foreman-rake foreman_tasks:export_tasks command with its options.
The thing is we already put the effort into modifying the code. We can consider changing the default if you feel it would help the customer experience. What about exporting all failed in the past 60 days and all in the past 7 days? Is that a reasonable default?
@Ivan: I believe we can go this way, make it 60 for the failed one and 7 for the rest as you said.
Ok, going to update the export task.
Moving to POST since upstream bug http://projects.theforeman.org/issues/14487 has been closed
Verified in satellite-6.2.3-1.0, successful stopped tasks are indeed included in task export. By inserting an "old" task into the the db confirmed that successful tasks older than 7 days are not included in task export.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:2108