class allura.model.monq_model.MonQTask

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.user for the task
  • args - *args to be sent to the task function
  • kwargs - **kwargs to be sent to the task function
  • result - if the task is complete, the return value. If in error, the traceback.
classmethod clear_complete()

Delete the task objects for complete tasks

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


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)

Create a new task object based on the current context.

classmethod run_ready(worker=None)

Run all the tasks that are currently ready

classmethod timeout_tasks(older_than)

Mark all busy tasks older than a certain datetime as ‘ready’ again. Used to retry ‘stuck’ tasks.