[Satellite 6] Is it possible to apply bulk actions to tasks?

Solution In Progress - Updated -

Environment

  • Red Hat Satellite 6

Issue

  • We want to cancel / resume several/many tasks (i.e. all sync tasks, all promotion tasks or so).

Is there a way of doing such bulk actions in Satellite 6, either in WebUI or in hammer command line interface (CLI)?

Resolution

Request for such feature (RFE) is tracked in this bugzilla. The RFE will be implemented in Satellite 6.1 (not yet available in Sat6.1beta). Since 6.1 GA release, hammer CLI offers bulk actions for tasks:

The hammer task list command may be used to get a list of tasks, with results refined through the --search option:

$ hammer task list --help
Usage:
    hammer task list [OPTIONS]

Options:
 --by BY                       Field to sort the results on
 --order ORDER                 Sort field and order, eg. 'name DESC'
 --page PAGE                   Page number, starting at 1
 --per-page PER_PAGE           Number of results per page to return
 --search SEARCH               Search string
 -h, --help                    print help


$ hammer task list --search paused --per-page 2
-------------------------------------|------|-------------------|---------------------|----------|--------|---------|-------------------|------------
ID                                   | NAME | OWNER             | STARTED AT          | ENDED AT | STATE  | RESULT  | TASK ACTION       | TASK ERRORS
-------------------------------------|------|-------------------|---------------------|----------|--------|---------|-------------------|------------
8ab75c2e-5811-4a21-ad21-ae98229eee92 |      | foreman_api_admin | 2015/07/16 11:42:21 |          | paused | pending | Metadata generate |            
97db1728-9f0f-43ad-8d03-93d3aaf50005 |      | foreman_api_admin | 2015/07/16 11:42:21 |          | paused | pending | Metadata generate |            
-------------------------------------|------|-------------------|---------------------|----------|--------|---------|-------------------|------------

The hammer task resume may be used to bulk resume specific tasks with the --task-ids:

$ hammer task resume --help
Usage:
    hammer task resume [OPTIONS]

Options:
 --search SEARCH               Resume tasks matching search string
 --task-ids TASK_IDS           Resume specific tasks by id
                               Comma separated list of values.
 --tasks TASK_NAMES            Comma separated list of values.
 -h, --help                    print help


$ hammer task resume --task-ids 97db1728-9f0f-43ad-8d03-93d3aaf50005
Total tasks found paused in error state: 1
Total tasks resumed:                     1
Resumed tasks:                           
 1) Task identifier: 97db1728-9f0f-43ad-8d03-93d3aaf50005
    Task action:     Metadata generate
    Task errors:
Total tasks failed to resume:            0
Failed tasks:                            

Total tasks skipped:                     0
Skipped tasks:

Or the tasks can be specified via --search option (any WebUI search string works well as argument of --search). E.g.:

hammer task resume --search 'state = paused'

will resume all paused tasks.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

1 Comments

Is there a way to overcome large task lists that thrown "Error: Request Timeout" when running hammer task list or a way to simply list those "pending" or "error" state tasks?

To this -- when using the Web UI and filtering under Monitor -> Tasks for result = pending, the bulk of the actions that are pending are:

Generate applicability ("services_checked"=>["pulp", "pulp_auth"], "system_ids"=>[XXXX], "locale"=>"en")

What are these tasks meant to accomplish and is there an existing bug that causes these to always show pending? We have ones from over a month ago still pending.

Was able to run:

hammer task resume --search "result = pending"

which kicked off a bunch out of the system but eventually did return a timeout error with 370 pending in queue.