ExecNodes
warning: This page describes some internal functionalities of Tawazi, it is still subject to change during minor releases.
ExecNode
dataclass
¶
Base class for executable node in a DAG.
An ExecNode is an Object that can be executed inside a DAG scheduler.
It basically consists of a function (exec_function) that takes args and kwargs and returns a value.
When the ExecNode is executed in the DAG, the resulting value will be stored in a dictionary.
Note: This class is not meant to be instantiated directly.
Please use @xn
decorator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id_ |
Identifier
|
Identifier. |
field(default='')
|
exec_function |
Callable
|
callable to execute in the DAG. |
field(default_factory=lambda : lambda : None)
|
args |
Optional[List[ExecNode]]
|
*args to pass to exec_function during execution. |
field(default_factory=list)
|
kwargs |
Optional[Dict[str, ExecNode]]
|
**kwargs to pass to exec_function during execution. |
field(default_factory=dict)
|
priority |
int
|
priority compared to other ExecNodes; the higher the number the higher the priority. |
0
|
is_sequential |
bool
|
whether to execute this ExecNode in sequential order with respect to others. (i.e. When this ExecNode must be executed, all other nodes are waited to finish before starting execution.) Defaults to False. |
TAWAZI_IS_SEQUENTIAL
|
debug |
bool
|
Make this ExecNode a debug Node. Defaults to False. |
False
|
tag |
TagOrTags
|
Attach a Tag or Tags to this ExecNode. Defaults to None. |
None
|
setup |
bool
|
Make this ExecNode a setup Node. Defaults to False. |
False
|
unpack_to |
Optional[int]
|
if not None, this ExecNode's execution must return unpacked results corresponding to the given value |
None
|
resource |
str
|
The resource to use to execute this ExecNode. Defaults to "thread". |
TAWAZI_DEFAULT_RESOURCE
|
Raises:
Type | Description |
---|---|
ValueError
|
if setup and debug are both True. |
id: Identifier
property
¶
The identifier of this ExecNode.
tag: Optional[TagOrTags] = None
class-attribute
instance-attribute
¶
debug: bool = False
class-attribute
instance-attribute
¶
setup: bool = False
class-attribute
instance-attribute
¶
priority: int = 0
class-attribute
instance-attribute
¶
is_sequential: bool = cfg.TAWAZI_IS_SEQUENTIAL
class-attribute
instance-attribute
¶
executed(results)
¶
Returns whether this ExecNode was executed or not.