Task to be executed by the taskd daemon.
- _id - bson.ObjectId() for this task
- state - ‘ready’, ‘busy’, ‘error’, ‘complete’, or ‘skipped’ task status
- priority - integer priority, higher is more priority
- result_type - either ‘keep’ or ‘forget’, what to do with the task when it’s done
- time_queue - time the task was queued
- time_start - time taskd began working on the task
- time_stop - time taskd stopped working on the task
- task_name - full dotted name of the task function to run
- process - identifier for which taskd process is working on the task
- context - values used to set c.project, c.app, c.user for the task
- args -
*argsto be sent to the task function
- kwargs -
**kwargsto be sent to the task function
- result - if the task is complete, the return value. If in error, the traceback.
Delete the task objects for complete tasks
get(process='worker', state='ready', waitfunc=None, only=None)¶
Get the highest-priority, oldest, ready task and lock it to the current process. If no task is available and waitfunc is supplied, call the waitfunc before trying to get the task again. If waitfunc is None and no tasks are available, return None. If waitfunc raises a StopIteration, stop waiting for a task
Wait until this task is either complete or errors out, then return the result.
Print all tasks of a certain status to sys.stdout. Used for debugging.
post(function, args=None, kwargs=None, result_type='forget', priority=10, delay=0)¶
Create a new task object based on the current context.
Run all the tasks that are currently ready
Mark all busy tasks older than a certain datetime as ‘ready’ again. Used to retry ‘stuck’ tasks.