allura.model.monq_model
¶
- class allura.model.monq_model.MonQTask¶
Task to be executed by the taskd daemon.
Properties
_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 -
*args
to be sent to the task functionkwargs -
**kwargs
to be sent to the task functionresult - if the task is complete, the return value. If in error, the traceback.
- classmethod 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
- join(poll_interval=0.1)¶
Wait until this task is either complete or errors out, then return the result.
- classmethod list(state='ready')¶
Print all tasks of a certain status to sys.stdout. Used for debugging.
- classmethod post(function, args=None, kwargs=None, result_type='forget', priority=10, delay=0, flush_immediately=True)¶
Create a new task object based on the current context.
- classmethod run_ready(worker=None)¶
Run all the tasks that are currently ready