cctools
Public Member Functions
work_queue.Task Class Reference

Python Task object. More...

Inheritance diagram for work_queue.Task:

Public Member Functions

def __init__ (self, command)
 Create a new task specification. More...
 
def specify_algorithm (self, algorithm)
 Set the worker selection algorithm for task. More...
 
def specify_tag (self, tag)
 Attach a user defined logical name to the task. More...
 
def specify_preferred_host (self, hostname)
 Indicate that the task would be optimally run on a given host. More...
 
def specify_file
 Add a file to the task. More...
 
def specify_input_file
 Add a input file to the task. More...
 
def specify_output_file
 Add a output file to the task. More...
 
def specify_buffer
 Add an input bufer to the task. More...
 
def specify_file_command
 Add a file created or handled by an arbitrary command to a task (eg. More...
 

Detailed Description

Python Task object.

This class is used to create a task specification.

Example:

1 # Create and specify Task
2 task = Task('date > current.date')
3 task.specify_algorithm(WORK_QUEUE_SCHEDULE_FCFS)
4 task.specify_input_file('/usr/bin/date', 'date')
5 task.specify_tag('my date task')
6 
7 # Create Work Queue and submit Task
8 work_queue = WorkQueue()
9 work_queue.submit(task)

Constructor & Destructor Documentation

def work_queue.Task.__init__ (   self,
  command 
)

Create a new task specification.

Parameters
selfReference to the current task object.
commandThe shell command line to be exected by the task.

References work_queue.Task._task, work_queue_task_create(), and work_queue_task_delete().

Member Function Documentation

def work_queue.Task.specify_algorithm (   self,
  algorithm 
)

Set the worker selection algorithm for task.

Parameters
selfReference to the current task object.
algorithmOne of the following algorithms to use in assigning a task to a worker:

References work_queue.Task._task, and work_queue_task_specify_algorithm().

def work_queue.Task.specify_tag (   self,
  tag 
)

Attach a user defined logical name to the task.

Parameters
selfReference to the current task object.
tagThe tag to attach to task.

References work_queue.Task._task, and work_queue_task_specify_tag().

def work_queue.Task.specify_preferred_host (   self,
  hostname 
)

Indicate that the task would be optimally run on a given host.

Parameters
selfReference to the current task object.
hostnameThe hostname to which this task would optimally be sent.

References work_queue.Task._task, and work_queue_task_specify_preferred_host().

def work_queue.Task.specify_file (   self,
  local_name,
  remote_name = None,
  type = None,
  flags = None,
  cache = True 
)

Add a file to the task.

Parameters
selfReference to the current task object.
local_nameThe name of the file on local disk or shared filesystem.
remote_nameThe name of the file at the execution site.
typeMust be one of the following values: WORK_QUEUE_INPUT or WORK_QUEUE_OUTPUT
flagsMay be zero to indicate no special handling, or any of the following or'd together:
cacheLegacy parameter for setting file caching attribute. By default this is enabled.

Example:

1 # The following are equivalent
2 >>> task.specify_file("/etc/hosts", type=WORK_QUEUE_INPUT, flags=WORK_QUEUE_NOCACHE)
3 >>> task.specify_file("/etc/hosts", "hosts", type=WORK_QUEUE_INPUT, cache=false)

References work_queue.Task._task, and work_queue_task_specify_file().

Referenced by work_queue.Task.specify_input_file(), and work_queue.Task.specify_output_file().

def work_queue.Task.specify_input_file (   self,
  local_name,
  remote_name = None,
  flags = None,
  cache = True 
)

Add a input file to the task.

This is just a wrapper for specify_file with type set to WORK_QUEUE_INPUT.

References work_queue.Task.specify_file().

def work_queue.Task.specify_output_file (   self,
  local_name,
  remote_name = None,
  flags = None,
  cache = True 
)

Add a output file to the task.

This is just a wrapper for specify_file with type set to WORK_QUEUE_OUTPUT.

References work_queue.Task.specify_file().

def work_queue.Task.specify_buffer (   self,
  buffer,
  remote_name,
  flags = None,
  cache = True 
)

Add an input bufer to the task.

Parameters
selfReference to the current task object.
bufferThe contents of the buffer to pass as input.
remote_nameThe name of the remote file to create.
flagsMay take the same values as specify_file.
cacheLegacy parameter for setting file caching attribute. By default this is enabled.

References work_queue.Task._task, and work_queue_task_specify_buffer().

def work_queue.Task.specify_file_command (   self,
  remote_name,
  command,
  type,
  flags,
  cache = True 
)

Add a file created or handled by an arbitrary command to a task (eg.

wget, ftp, chirp_get|put).

Parameters
selfReference to the current task object.
remote_nameThe name of the remote file at the execution site.
commandThe contents of the buffer to pass as input.
typeMust be one of the following values: WORK_QUEUE_INPUT or WORK_QUEUE_OUTPUT
flagsMay take the same values as specify_file.
cacheLegacy parameter for setting file caching attribute. By default this is enabled.

References work_queue.Task._task, and work_queue_task_specify_file_command().


The documentation for this class was generated from the following file: