Bug 1314207 - Task export should include successful tasks as well as the pending or errored one
Summary: Task export should include successful tasks as well as the pending or errored...
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.1.6
Hardware: x86_64
OS: Linux
Target Milestone: Unspecified
Assignee: David Davis
QA Contact: Peter Ondrejka
URL: http://projects.theforeman.org/issues...
Depends On:
TreeView+ depends on / blocked
Reported: 2016-03-03 08:51 UTC by Marcel Gazdík
Modified: 2019-10-10 11:25 UTC (History)
10 users (show)

Fixed In Version: rubygem-foreman-tasks-
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-10-26 12:25:35 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14487 0 Normal Closed Task export should include successful tasks as well as the pending or errored one 2020-03-19 12:23:36 UTC
Red Hat Product Errata RHBA-2016:2108 0 normal SHIPPED_LIVE Satellite 6.2.3 Async Bug Release 2016-10-26 16:21:52 UTC

Description Marcel Gazdík 2016-03-03 08:51:00 UTC
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

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

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.

Comment 2 Bryan Kearney 2016-04-05 17:47:50 UTC
Created redmine issue http://projects.theforeman.org/issues/14487 from this bug

Comment 3 Bryan Kearney 2016-04-06 08:06:43 UTC
Upstream bug component is Content Management

Comment 4 Bryan Kearney 2016-04-18 14:06:59 UTC
Upstream bug component is Tasks Plugin

Comment 5 Ivan Necas 2016-04-25 13:53:50 UTC
I suggest the search-based param to the export, similar as we have in cleanup task


It would be customizable by an environment variable, with some sane default, that we can discuss here.

Comment 8 David Davis 2016-05-17 13:03:56 UTC
The export task can already export successful tasks but it doesn't do so by default. See:


Comment 9 David Davis 2016-05-17 13:04:47 UTC
I do like the idea of removing 'tasks' and adding a 'filter' option but I worry about backwards compatibility (ie is anyone using 'tasks'?).

Comment 10 Ivan Necas 2016-05-17 14:05:56 UTC
We can keep the ENV['tasks'] there, maybe with deprecation with suggestion to use the filter instead

Comment 11 Bryan Kearney 2016-05-17 16:31:29 UTC
Upstream bug assigned to inecas

Comment 12 Bryan Kearney 2016-05-18 08:18:26 UTC
Upstream bug assigned to daviddavis

Comment 14 Ivan Necas 2016-06-02 10:26:48 UTC
The PR that fixes the issue is available https://github.com/theforeman/foreman-tasks/pull/186

Comment 15 David Davis 2016-06-02 19:39:40 UTC
Now, to do a foreman-debug that would include all tasks (and not just errorred ones), you'd do:

export TASK_SEARCH=''

Comment 16 Ivan Necas 2016-06-03 08:41:13 UTC
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=''

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.

Comment 17 Mike McCune 2016-06-03 18:42:54 UTC
+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.

Comment 18 Marcel Gazdík 2016-06-06 18:47:05 UTC
@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.

Comment 19 Ivan Necas 2016-06-07 22:12:40 UTC
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?

Comment 20 Marcel Gazdík 2016-06-08 15:28:49 UTC
@Ivan: I believe we can go this way, make it 60 for the failed one and 7 for the rest as you said.

Comment 21 David Davis 2016-06-08 19:12:03 UTC
Ok, going to update the export task.

Comment 22 Bryan Kearney 2016-08-10 08:12:37 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14487 has been closed

Comment 23 Peter Ondrejka 2016-10-11 10:45:03 UTC
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.

Comment 25 errata-xmlrpc 2016-10-26 12:25:35 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.