work_queue::Task Class Reference

Python Task object. More...

Public Member Functions

def __init__
 Create a new task specification.
def clone
 Return a copy of this task.
def specify_command
 Set the command to be executed by the task.
def specify_algorithm
 Set the worker selection algorithm for task.
def specify_tag
 Attach a user defined logical name to the task.
def specify_preferred_host
 Indicate that the task would be optimally run on a given host.
def specify_file
 Add a file to the task.
def specify_file_piece
 Add a file piece to the task.
def specify_input_file
 Add a input file to the task.
def specify_output_file
 Add a output file to the task.
def specify_directory
 Add a directory to the task.
def specify_buffer
 Add an input bufer to the task.
def specify_cores
 Indicate the number of cores required by this task.
def specify_memory
 Indicate the memory (in MB) required by this task.
def specify_disk
 Indicate the disk space (in MB) required by this task.
def specify_priority
 Indicate the the priority of this task (larger means better priority, default is 0).
def tag
 Get the user-defined logical name for the task.
def command
 Get the shell command executed by the task.
def algorithm
 Get the algorithm for choosing worker to run the task.
def output
 Get the standard output of the task.
def id
 Get the task id number.
def return_status
 Get the exit code of the command executed by the task.
def result
 Get the result of the task (successful, failed return_status, missing input file, missing output file).
def total_submissions
 Get the number of times the task has been resubmitted internally.
def host
 Get the address and port of the host on which the task ran.
def hostname
 Get the name of the host on which the task ran.
def submit_time
 Get the time at which this task was submitted.
def finish_time
 Get the time at which this task was finished.
def app_delay
 Get the time spent in upper-level application (outside of work_queue_wait).
def send_input_start
 Get the time at which the task started to transfer input files.
def send_input_finish
 Get the time at which the task finished transferring input files.
def execute_cmd_start
 The time at which the task began.
def execute_cmd_finish
 Get the time at which the task finished (discovered by the master).
def receive_output_start
 Get the time at which the task started to transfer output files.
def receive_output_finish
 Get the time at which the task finished transferring output files.
def total_bytes_received
 Get the number of bytes received since task started receiving input data.
def total_bytes_sent
 Get the number of bytes sent since task started sending input data.
def total_bytes_transferred
 Get the number of bytes transferred since task started transferring input data.
def total_transfer_time
 Get the time comsumed in microseconds for transferring total_bytes_transferred.
def cmd_execution_time
 Get the time spent in microseconds for executing the command on the worker.
def total_cmd_execution_time
 Get the time spent in microseconds for executing the command on any worker.
def resources_measured
 Get the resources measured for the task execution if resource monitoring is enabled.

Detailed Description

Python Task object.

This class is used to create a task specification.


Member Function Documentation

def work_queue::Task::__init__ (   self,
  command 
)

Create a new task specification.

Parameters:
self Reference to the current task object.
command The shell command line to be exected by the task.
def work_queue::Task::clone (   self  ) 

Return a copy of this task.

Return a (deep)copy this task that can also be submitted to the WorkQueue.
def work_queue::Task::specify_command (   self,
  command 
)

Set the command to be executed by the task.

Parameters:
self Reference to the current task object.
command The command to be executed.
def work_queue::Task::specify_algorithm (   self,
  algorithm 
)

Set the worker selection algorithm for task.

Parameters:
self Reference to the current task object.
algorithm One of the following algorithms to use in assigning a task to a worker:

def work_queue::Task::specify_tag (   self,
  tag 
)

Attach a user defined logical name to the task.

Parameters:
self Reference to the current task object.
tag The tag to attach to task.
def work_queue::Task::specify_preferred_host (   self,
  hostname 
)

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

Parameters:
self Reference to the current task object.
hostname The hostname to which this task would optimally be sent.
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:
self Reference to the current task object.
local_name The name of the file on local disk or shared filesystem.
remote_name The name of the file at the execution site.
type Must be one of the following values: WORK_QUEUE_INPUT or WORK_QUEUE_OUTPUT
flags May be zero to indicate no special handling, or any of the following or'd together:

cache Legacy parameter for setting file caching attribute. By default this is enabled.

For example:

 # The following are equivalent
 >>> task.specify_file("/etc/hosts", type=WORK_QUEUE_INPUT, flags=WORK_QUEUE_NOCACHE)
 >>> task.specify_file("/etc/hosts", "hosts", type=WORK_QUEUE_INPUT, cache=false)
def work_queue::Task::specify_file_piece (   self,
  local_name,
  remote_name = None,
  start_byte = 0,
  end_byte = 0,
  type = None,
  flags = None,
  cache = True 
)

Add a file piece to the task.

Parameters:
self Reference to the current task object.
local_name The name of the file on local disk or shared filesystem.
remote_name The name of the file at the execution site.
start_byte The starting byte offset of the file piece to be transferred.
end_byte The ending byte offset of the file piece to be transferred.
type Must be one of the following values: WORK_QUEUE_INPUT or WORK_QUEUE_OUTPUT
flags May be zero to indicate no special handling, or any of the following or'd together:

cache Legacy parameter for setting file caching attribute. By default this is enabled.
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.

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.

def work_queue::Task::specify_directory (   self,
  local_name,
  remote_name = None,
  type = None,
  flags = None,
  recursive = 0,
  cache = True 
)

Add a directory to the task.

Parameters:
self Reference to the current task object.
local_name The name of the directory on local disk or shared filesystem. Optional if the directory is empty.
remote_name The name of the directory at the remote execution site.
type Must be one of the following values: WORK_QUEUE_INPUT or WORK_QUEUE_OUTPUT
flags May be zero to indicate no special handling, or any of the following or'd together:

recursive Indicates whether just the directory (0) or the directory and all of its contents (1) should be included.
cache Legacy parameter for setting file caching attribute. By default this is enabled.
Returns:
1 if the task directory is successfully specified, 0 if either of local_name, or remote_name is null or remote_name is an absolute path.
def work_queue::Task::specify_buffer (   self,
  buffer,
  remote_name,
  flags = None,
  cache = True 
)

Add an input bufer to the task.

Parameters:
self Reference to the current task object.
buffer The contents of the buffer to pass as input.
remote_name The name of the remote file to create.
flags May take the same values as specify_file.
cache Legacy parameter for setting file caching attribute. By default this is enabled.
def work_queue::Task::specify_cores (   self,
  cores 
)

Indicate the number of cores required by this task.

def work_queue::Task::specify_memory (   self,
  memory 
)

Indicate the memory (in MB) required by this task.

def work_queue::Task::specify_disk (   self,
  disk 
)

Indicate the disk space (in MB) required by this task.

def work_queue::Task::specify_priority (   self,
  priority 
)

Indicate the the priority of this task (larger means better priority, default is 0).

def work_queue::Task::tag (   self  ) 

Get the user-defined logical name for the task.

Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.tag
def work_queue::Task::command (   self  ) 

Get the shell command executed by the task.

Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.command
def work_queue::Task::algorithm (   self  ) 

Get the algorithm for choosing worker to run the task.

Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.algorithm
def work_queue::Task::output (   self  ) 

Get the standard output of the task.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.output
def work_queue::Task::id (   self  ) 

Get the task id number.

Must be called only after the task was submitted. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.id
def work_queue::Task::return_status (   self  ) 

Get the exit code of the command executed by the task.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.return_status
def work_queue::Task::result (   self  ) 

Get the result of the task (successful, failed return_status, missing input file, missing output file).

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.result
def work_queue::Task::total_submissions (   self  ) 

Get the number of times the task has been resubmitted internally.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.total_submissions
def work_queue::Task::host (   self  ) 

Get the address and port of the host on which the task ran.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.host
def work_queue::Task::hostname (   self  ) 

Get the name of the host on which the task ran.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.hostname
def work_queue::Task::submit_time (   self  ) 

Get the time at which this task was submitted.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.submit_time
def work_queue::Task::finish_time (   self  ) 

Get the time at which this task was finished.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.finish_time
def work_queue::Task::app_delay (   self  ) 

Get the time spent in upper-level application (outside of work_queue_wait).

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.app_delay
def work_queue::Task::send_input_start (   self  ) 

Get the time at which the task started to transfer input files.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.send_input_start
def work_queue::Task::send_input_finish (   self  ) 

Get the time at which the task finished transferring input files.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.send_input_finish
def work_queue::Task::execute_cmd_start (   self  ) 

The time at which the task began.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.execute_cmd_start
def work_queue::Task::execute_cmd_finish (   self  ) 

Get the time at which the task finished (discovered by the master).

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.execute_cmd_finish
def work_queue::Task::receive_output_start (   self  ) 

Get the time at which the task started to transfer output files.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.receive_output_start
def work_queue::Task::receive_output_finish (   self  ) 

Get the time at which the task finished transferring output files.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.receive_output_finish
def work_queue::Task::total_bytes_received (   self  ) 

Get the number of bytes received since task started receiving input data.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.total_bytes_received
def work_queue::Task::total_bytes_sent (   self  ) 

Get the number of bytes sent since task started sending input data.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.total_bytes_sent
def work_queue::Task::total_bytes_transferred (   self  ) 

Get the number of bytes transferred since task started transferring input data.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.total_bytes_transferred
def work_queue::Task::total_transfer_time (   self  ) 

Get the time comsumed in microseconds for transferring total_bytes_transferred.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.total_transfer_time
def work_queue::Task::cmd_execution_time (   self  ) 

Get the time spent in microseconds for executing the command on the worker.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.cmd_execution_time
def work_queue::Task::total_cmd_execution_time (   self  ) 

Get the time spent in microseconds for executing the command on any worker.

Must be called only after the task completes execution. Note: This is defined using property decorator. So it must be called without parentheses (). For example:

 >>> print t.total_cmd_execution_time
def work_queue::Task::resources_measured (   self  ) 

Get the resources measured for the task execution if resource monitoring is enabled.

Must be called only after the task completes execution.

 >>> print t.resources_measured('resident_memory')

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

Generated on 24 Jun 2015 for cctools by  doxygen 1.6.1