cctools
ndcctools.work_queue.RemoteTask Class Reference

Python RemoteTask object. More...

Inheritance diagram for ndcctools.work_queue.RemoteTask:
ndcctools.work_queue.Task

Public Member Functions

 __init__ (self, fn, coprocess, *args, **kwargs)
 Create a new remote task specification.
 
 specify_fn_args (self, args=[], kwargs={})
 Specify function arguments.
 
 specify_exec_method (self, remote_task_exec_method)
 Specify how the remote task should execute.
 
- Public Member Functions inherited from ndcctools.work_queue.Task
 clone (self)
 Return a copy of this task.
 
 specify_command (self, command)
 Set the command to be executed by the task.
 
 specify_coprocess (self, coprocess)
 Set the coprocess at the worker that should execute the task's command.
 
 specify_algorithm (self, algorithm)
 Set the worker selection algorithm for task.
 
 specify_tag (self, tag)
 Attach a user defined logical name to the task.
 
 specify_category (self, name)
 Label the task with the given category.
 
 specify_feature (self, name)
 Label the task with the given user-defined feature.
 
 specify_file (self, local_name, remote_name=None, type=None, flags=None, cache=None, failure_only=None)
 Add a file to the task.
 
 specify_url (self, url, remote_name, type=None, flags=None, cache=None, failure_only=None)
 Add a url to the task which will be provided as an input file.
 
 specify_file_command (self, cmd, remote_name, type=None, flags=None, cache=None, failure_only=None)
 Add an input file produced by a Unix shell command.
 
 specify_file_piece (self, local_name, remote_name=None, start_byte=0, end_byte=0, type=None, flags=None, cache=None, failure_only=None)
 Add a file piece to the task.
 
 specify_input_file (self, local_name, remote_name=None, flags=None, cache=None)
 Add a input file to the task.
 
 specify_output_file (self, local_name, remote_name=None, flags=None, cache=None, failure_only=None)
 Add a output file to the task.
 
 specify_directory (self, local_name, remote_name=None, type=None, flags=None, recursive=False, cache=None, failure_only=None)
 Add a directory to the task.
 
 specify_buffer (self, buffer, remote_name, flags=None, cache=None)
 Add an input bufer to the task.
 
 specify_snapshot_file (self, filename)
 When monitoring, indicates a json-encoded file that instructs the monitor to take a snapshot of the task resources.
 
 specify_max_retries (self, max_retries)
 Indicate the number of times the task should be retried.
 
 specify_cores (self, cores)
 Indicate the number of cores required by this task.
 
 specify_memory (self, memory)
 Indicate the memory (in MB) required by this task.
 
 specify_disk (self, disk)
 Indicate the disk space (in MB) required by this task.
 
 specify_gpus (self, gpus)
 Indicate the number of GPUs required by this task.
 
 specify_priority (self, priority)
 Indicate the the priority of this task (larger means better priority, default is 0).
 
 specify_environment_variable (self, name, value=None)
 Set this environment variable before running the task.
 
 specify_monitor_output (self, directory)
 Set a name for the resource summary output directory from the monitor.
 
 tag (self)
 Get the user-defined logical name for the task.
 
 category (self)
 Get the category name for the task.
 
 command (self)
 Get the shell command executed by the task.
 
 priority (self)
 Get the priority of the task.
 
 algorithm (self)
 Get the algorithm for choosing worker to run the task.
 
 std_output (self)
 Get the standard output of the task.
 
 output (self)
 Get the standard output of the task.
 
 id (self)
 Get the task id number.
 
 return_status (self)
 Get the exit code of the command executed by the task.
 
 result (self)
 Get the result of the task as an integer code, such as successful, missing file, etc.
 
 result_str (self)
 Return a string that explains the result of a task.
 
 total_submissions (self)
 Get the number of times the task has been resubmitted internally.
 
 exhausted_attempts (self)
 Get the number of times the task has been failed given resource exhaustion.
 
 host (self)
 Get the address and port of the host on which the task ran.
 
 hostname (self)
 Get the name of the host on which the task ran.
 
 submit_time (self)
 Get the time at which this task was submitted.
 
 finish_time (self)
 Get the time at which this task was finished.
 
 total_cmd_exhausted_execute_time (self)
 Get the total time the task executed and failed given resource exhaustion.
 
 app_delay (self)
 Get the time spent in upper-level application (outside of work_queue_wait).
 
 send_input_start (self)
 Get the time at which the task started to transfer input files.
 
 send_input_finish (self)
 Get the time at which the task finished transferring input files.
 
 execute_cmd_start (self)
 The time at which the task began.
 
 execute_cmd_finish (self)
 Get the time at which the task finished (discovered by the manager).
 
 receive_output_start (self)
 Get the time at which the task started to transfer output files.
 
 receive_output_finish (self)
 Get the time at which the task finished transferring output files.
 
 total_bytes_received (self)
 Get the number of bytes received since task started receiving input data.
 
 total_bytes_sent (self)
 Get the number of bytes sent since task started sending input data.
 
 total_bytes_transferred (self)
 Get the number of bytes transferred since task started transferring input data.
 
 total_transfer_time (self)
 Get the time comsumed in microseconds for transferring total_bytes_transferred.
 
 cmd_execution_time (self)
 Time spent in microseconds for executing the command until completion on a single worker.
 
 total_cmd_execution_time (self)
 Accumulated time spent in microseconds for executing the command on any worker, regardless of whether the task finished (i.e., this includes time running on workers that disconnected).
 
 resources_measured (self)
 Get the resources measured for the task execution if resource monitoring is enabled.
 
 limits_exceeded (self)
 Get the resources the task exceeded.
 
 resources_requested (self)
 Get the resources the task requested to run.
 
 resources_allocated (self)
 Get the resources allocated to the task in its latest attempt.
 

Detailed Description

Python RemoteTask object.

This class is used to create a task that will execute on a worker running a coprocess

Constructor & Destructor Documentation

◆ __init__()

ndcctools.work_queue.RemoteTask.__init__ ( self,
fn,
coprocess,
* args,
** kwargs )

Create a new remote task specification.

Parameters
selfReference to the current remote task object.
fnThe name of the function to be executed on the coprocess
coprocessThe name of the coprocess which has the function you wish to execute. The coprocess should have a name() method that returns this
argspositional arguments used in function to be executed by task. Can be mixed with kwargs
kwargskeyword arguments used in function to be executed by task.

Reimplemented from ndcctools.work_queue.Task.

Member Function Documentation

◆ specify_fn_args()

ndcctools.work_queue.RemoteTask.specify_fn_args ( self,
args = [],
kwargs = {} )

Specify function arguments.

Accepts arrays and dictionarys. This overrides any arguments passed during task creation

Parameters
selfReference to the current remote task object
argsAn array of positional args to be passed to the function
kwargsA dictionary of keyword arguments to be passed to the function

◆ specify_exec_method()

ndcctools.work_queue.RemoteTask.specify_exec_method ( self,
remote_task_exec_method )

Specify how the remote task should execute.

Parameters
selfReference to the current remote task object
remote_task_exec_methodCan be one of "fork", "direct", or "thread". Fork creates a child process to execute the function, direct has the worker directly call the function, and thread spawns a thread to execute the function

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