dragon.workflows.batch.batch.Function
- class Function[source]
Bases:
Task- __init__(batch, target: Callable , args: tuple = (), kwargs: dict = {}, reads: list | None = None, writes: list | None = None, name: str | None = None, timeout: float = 1000000000.0) None [source]
Creates a new function task. Arguments for the function that are of type
Taskwill create a dependency for this task on the output of the task specified by the argument. Further, the output of the specified task will be passed in place of theTaskargument when the function executes.- Parameters:
batch – The batch in which this function task will execute.
func – The function to associate with the object.
*args –
The arguments for the function.
reads (Optional[list ]) – A list of
Readobjects created by callingBatch.read().writes (Optional[list ]) – A list of
Writeobjects created by callingBatch.write().name (Optional[str ]) – A human-readable name for the task.
- Returns:
Returns None.
- Return type:
None
Methods
__init__(batch, target[, args, kwargs, ...])Creates a new function task.
dump_dag(file_name)Dump a PNG image of the dependency DAG associated with a compiled program.
get([block, timeout])Wait for this Task to complete.
Attributes
Provides the unique ID for this task.
- __init__(batch, target: Callable , args: tuple = (), kwargs: dict = {}, reads: list | None = None, writes: list | None = None, name: str | None = None, timeout: float = 1000000000.0) None [source]
Creates a new function task. Arguments for the function that are of type
Taskwill create a dependency for this task on the output of the task specified by the argument. Further, the output of the specified task will be passed in place of theTaskargument when the function executes.- Parameters:
batch – The batch in which this function task will execute.
func – The function to associate with the object.
*args –
The arguments for the function.
reads (Optional[list ]) – A list of
Readobjects created by callingBatch.read().writes (Optional[list ]) – A list of
Writeobjects created by callingBatch.write().name (Optional[str ]) – A human-readable name for the task.
- Returns:
Returns None.
- Return type:
None
- dump_dag(file_name: str ) None [source]
Dump a PNG image of the dependency DAG associated with a compiled program.
- Parameters:
file_name – Name for the new PNG file.
- Returns:
Returns None.
- Return type:
None
- get(block: bool = True, timeout: float = 1000000000.0) None [source]
Wait for this Task to complete. This function returns the task’s result and prints any stdout/stderr output.
- Parameters:
- Raises:
TimeoutError – If the specified timeout is exceeded.
:raises
TaskNotReadyError: If block is False and the result is not yet available.- Returns:
Returns the result of the task.
- Return type:
Any
- property uid
Provides the unique ID for this task.