A.20. Tasks
A.20.1. Task object fields
- id <str> unique id (usually a uuid) for the task
- job_id <str> associate job id
- class_name <str> name of the class, if the task's method is an instance method
- method_name <str> name of the pulp library method that was called
- state <str> one of several valid states of the tasks lifetime: waiting, running, finished, error, timed_out, canceled, reset, suspended
- start_time <str or nil> time the task started running in iso8601 format, nil if the task has not yet started
- finish_time <or nil> time the task finished running in iso8601 format, nil if the task has not yet finished
- result <object or nil> the result of the pulp library method upon return, usually nil
- exception <str or nil> a string representation of an error in the pulp library call, if any
- traceback <str or nil> a string print out of the trace back for the exception, if any
- progress <object or nil> object representing the pulp library call's progress, nil if no information is available
- scheduled_time <str or nil> time the task is scheduled to run in iso8601 format, applicable only for scheduled tasks
- snapshot_id <str> id of task's snapshot, if it has one
A.20.2. TaskSnapshot object fields
- id <str> unique task id
- class_name <str> name of the class, if the task's method is an instance method
- method_name <str> name of the pulp library method that was called
- state <str> one of several valid states of the tasks lifetime: waiting, running, finished, error, timed_out, canceled, reset, suspended
- failure_threshold <int> number of failures allowed this task before it is no longer scheduled
- cancel_attempts <int> the number of times cancel was called on this task
- callable <str> pickled task method
- args <str> pickled arguments for the task method
- kwargs <str> picked keyword arguments for the task method
- progress <object or nil> object representing the pulp library call's progress, nil if no information is available
- timeout <str> pickled timedelta representing the time limit for the task's run
- schedule_threshold <str> pickled timedelta representing a max difference between the scheduled_time and start_time before an error is logged
- _progress_callback <str> pickled method allowing progress information to be recorded by the task
- start_time <str> pickled datetime showing the start time of the task
- finish_time <str> pickled datetime showing the finish time of the task
- result <str> pickled result of the task call
- exception <str> pickled error, if one occurred
- traceback <str> pickled traceback, if one occurred
A.20.3. Get a Task
To get a Task object for a specific task:
- method: GET
- path: /tasks/<id>/
- permission: READ
- success response: 200 OK
- failure response:
- 404 Not Found if no such task
- return:Task object
- sample response:
{ "scheduled_time": "2012-01-05T06:00:00Z", "exception": null, "args": [], "job_id": null, "class_name": null, "start_time": null, "traceback": null, "method_name": "cull_history", "finish_time": null, "state": "waiting", "result": null, "scheduler": "interval", "snapshot_id": null, "progress": null, "id": "7e419e4f-3719-11e1-9ea0-f0def14122c8" }
{ "scheduled_time": "2012-01-05T06:00:00Z", "exception": null, "args": [], "job_id": null, "class_name": null, "start_time": null, "traceback": null, "method_name": "cull_history", "finish_time": null, "state": "waiting", "result": null, "scheduler": "interval", "snapshot_id": null, "progress": null, "id": "7e419e4f-3719-11e1-9ea0-f0def14122c8" }
Copy to Clipboard Copied!
A.20.4. Get all Task
To get a list of all tasks currently in the tasking system:
- method: GET
- path: /tasks/
- permission: READ
- success response: 200 OK
- failure response: None
- 404 Not Found if no such task
- return: list of task objects
- filters:
- id <str> task id
- state <str> tasking system task state: waiting, running, complete, incomplete, current, archived (current is the same as waiting, running, complete, and incomplete, also the same as omitting the state filter; archived looks into the task history, will not return archived tasks without this filter )
- sample response:
[ { "scheduled_time": "2012-01-05T01:00:00Z", "exception": null, "args": [], "job_id": null, "class_name": null, "start_time": null, "traceback": null, "method_name": "cull_audited_events", "finish_time": null, "state": "waiting", "result": null, "scheduler": "interval", "snapshot_id": null, "progress": null, "id": "6cd50f8f-371a-11e1-ba28-f0def14122c8" }, { "scheduled_time": "2012-01-05T06:00:00Z", "exception": null, "args": [], "job_id": null, "class_name": null, "start_time": null, "traceback": null, "method_name": "cull_history", "finish_time": null, "state": "waiting", "result": null, "scheduler": "interval", "snapshot_id": null, "progress": null, "id": "6cd53278-371a-11e1-ba29-f0def14122c8" } ]
[ { "scheduled_time": "2012-01-05T01:00:00Z", "exception": null, "args": [], "job_id": null, "class_name": null, "start_time": null, "traceback": null, "method_name": "cull_audited_events", "finish_time": null, "state": "waiting", "result": null, "scheduler": "interval", "snapshot_id": null, "progress": null, "id": "6cd50f8f-371a-11e1-ba28-f0def14122c8" }, { "scheduled_time": "2012-01-05T06:00:00Z", "exception": null, "args": [], "job_id": null, "class_name": null, "start_time": null, "traceback": null, "method_name": "cull_history", "finish_time": null, "state": "waiting", "result": null, "scheduler": "interval", "snapshot_id": null, "progress": null, "id": "6cd53278-371a-11e1-ba29-f0def14122c8" } ]
Copy to Clipboard Copied!