cctools
ndcctools.taskvine.task.FunctionCall Class Reference

TaskVine FunctionCall object. More...

Inheritance diagram for ndcctools.taskvine.task.FunctionCall:
ndcctools.taskvine.task.Task

Public Member Functions

def __init__ (self, coprocess, fn, args, kwargs)
 Create a new FunctionCall specification. More...
 
def submit_finalize (self, manager)
 Finalizes the task definition once the manager that will execute is run. More...
 
def set_fn_args (self, args=[], kwargs={})
 Specify function arguments. More...
 
def set_exec_method (self, remote_task_exec_method)
 Specify how the remote task should execute. More...
 
- Public Member Functions inherited from ndcctools.taskvine.task.Task
def __init__ (self, command, task_info)
 Create a new task specification. More...
 
def submit_finalize (self, manager)
 Finalizes the task definition once the manager that will execute is run. More...
 
def clone (self)
 Return a copy of this task. More...
 
def set_command (self, command)
 Set the command to be executed by the task. More...
 
def set_coprocess (self, coprocess)
 Set the coprocess at the worker that should execute the task's command. More...
 
def set_scheduler (self, scheduler)
 Set the worker selection scheduler for task. More...
 
def set_tag (self, tag)
 Attach a user defined logical name to the task. More...
 
def set_category (self, name)
 Label the task with the given category. More...
 
def add_feature (self, name)
 Label the task with the given user-defined feature. More...
 
def add_input (self, file, remote_name, strict_input=False)
 Add any input object to a task. More...
 
def add_output (self, file, remote_name, watch=False, failure_only=None, success_only=None)
 Add any output object to a task. More...
 
def set_snapshot_file (self, filename)
 When monitoring, indicates a json-encoded file that instructs the monitor to take a snapshot of the task resources. More...
 
def add_environment (self, f)
 Adds an execution environment to the task. More...
 
def set_retries (self, max_retries)
 Indicate the number of times the task should be retried. More...
 
def set_cores (self, cores)
 Indicate the number of cores required by this task. More...
 
def set_memory (self, memory)
 Indicate the memory (in MB) required by this task. More...
 
def set_disk (self, disk)
 Indicate the disk space (in MB) required by this task. More...
 
def set_gpus (self, gpus)
 Indicate the number of GPUs required by this task. More...
 
def set_priority (self, priority)
 Indicate the the priority of this task (larger means better priority, default is 0). More...
 
def set_env_var (self, name, value=None)
 Set this environment variable before running the task. More...
 
def set_monitor_output (self, directory)
 Set a name for the resource summary output directory from the monitor. More...
 
def tag (self)
 Get the user-defined logical name for the task. More...
 
def category (self)
 Get the category name for the task. More...
 
def command (self)
 Get the shell command executed by the task. More...
 
def std_output (self)
 Get the standard output of the task. More...
 
def output (self)
 Get the standard output of the task. More...
 
def id (self)
 Get the task id number. More...
 
def exit_code (self)
 Get the exit code of the command executed by the task. More...
 
def result (self)
 Return a string that explains the result of a task. More...
 
def completed (self)
 Return True if task executed and its command terminated normally. More...
 
def successful (self)
 Return True if task executed successfully, (i.e. More...
 
def get_metric (self, name)
 Return various integer performance metrics about a completed task. More...
 
def addrport (self)
 Get the address and port of the host on which the task ran. More...
 
def hostname (self)
 Get the address and port of the host on which the task ran. More...
 
def resources_measured (self)
 Get the resources measured for the task execution if resource monitoring is enabled. More...
 
def limits_exceeded (self)
 Get the resources the task exceeded. More...
 
def resources_requested (self)
 Get the resources the task requested to run. More...
 
def resources_allocated (self)
 Get the resources allocated to the task in its latest attempt. More...
 

Detailed Description

TaskVine FunctionCall object.

This class represents a task specialized to execute functions in a Library running on a worker.

Constructor & Destructor Documentation

◆ __init__()

def ndcctools.taskvine.task.FunctionCall.__init__ (   self,
  coprocess,
  fn,
  args,
  kwargs 
)

Create a new FunctionCall specification.

Parameters
selfReference to the current FunctionCall object.
coprocessThe name of the coprocess which has the function you wish to execute. The coprocess should have a name() method that returns this
fnThe name of the function to be executed on the coprocess
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.

Member Function Documentation

◆ submit_finalize()

def ndcctools.taskvine.task.FunctionCall.submit_finalize (   self,
  manager 
)

Finalizes the task definition once the manager that will execute is run.

This function is run by the manager before registering the task for execution.

Parameters
selfReference to the current python task object
managerManager to which the task was submitted

◆ set_fn_args()

def ndcctools.taskvine.task.FunctionCall.set_fn_args (   self,
  args = [],
  kwargs = {} 
)

Specify function arguments.

Accepts arrays and dictionaries. 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

◆ set_exec_method()

def ndcctools.taskvine.task.FunctionCall.set_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 either of "fork" or "direct". Fork creates a child process to execute the function and direct has the worker directly call the function.

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