Package pulp :: Package server :: Package tasking :: Package queue :: Module base :: Class TaskQueue
[hide private]
[frames] | no frames]

Class TaskQueue

source code

object --+
         |
        TaskQueue

Abstract base class for task queues for interface definition and typing.

Instance Methods [hide private]
 
enqueue(self, task, unique=False)
Add a task to the task queue
source code
 
run(self, task)
Run a task from this task queue
source code
 
complete(self, task)
Mark a task run as completed
source code
 
cancel(self, task)
Cancel a running task.
source code
 
find(self, **kwargs)
Find a task in this task queue.
source code
 
exists(self, task, criteria, include_finished=True)
Returns whether or not the given task exists in this queue.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

enqueue(self, task, unique=False)

source code 

Add a task to the task queue

Parameters:
  • task (pulp.tasking.task.Task) - Task instance
  • unique (bool) - If True, the task will only be added if there are no non-finished tasks with the same method_name, args, and kwargs; otherwise the task will always be added
Returns:
True if a new task was created; False if it was rejected (due to the unique flag

run(self, task)

source code 

Run a task from this task queue

Parameters:
  • task (pulp.tasking.task.Task) - Task instance

complete(self, task)

source code 

Mark a task run as completed

Parameters:
  • task (pulp.tasking.task.Task) - Task instance

cancel(self, task)

source code 

Cancel a running task.

Parameters:
  • task (pulp.tasking.task.Task) - Task instance

find(self, **kwargs)

source code 

Find a task in this task queue. Only the oldest task in the queue will be returned.

Parameters:
  • kwargs (dict) - task attributes and values as search criteria
  • include_finished (bool)
Returns:
Task instance on success, None otherwise

exists(self, task, criteria, include_finished=True)

source code 

Returns whether or not the given task exists in this queue. The list of which attributes that will be checked on the task for equality is determined by the entries in the criteria list.

Parameters:
  • task (Task instance) - Values in this task will be used to test for this task's existence in the queue
  • criteria (List; cannot be None) - List of attribute names in the Task class; a task is considered equal to the given task if the values for all attributes listed in here are equal in an existing task in the queue
  • include_finished (bool) - If True, finished tasks will be included in the search; otherwise only running and waiting tasks are searched (defaults to True)