Skip to content

Others

Equivalent of and wrapped in ExecNode.

Source code in tawazi/_object_helpers.py
@xn
def and_(a: T, b: V) -> Union[T, V]:
    """Equivalent of `and` wrapped in ExecNode."""
    return a and b

Equivalent of or wrapped in ExecNode.

Source code in tawazi/_object_helpers.py
@xn
def or_(a: T, b: V) -> Union[T, V]:
    """Equivalent of `or` wrapped in ExecNode."""
    return a or b

Equivalent of not wrapped in ExecNode.

Source code in tawazi/_object_helpers.py
@xn
def not_(a: Any) -> bool:
    """Equivalent of `not` wrapped in ExecNode."""
    return not a

Bases: str, Enum

The strategy to use when an error is raised inside a function in a DAG.

Source code in tawazi/errors.py
@unique
class ErrorStrategy(str, Enum):
    """The strategy to use when an error is raised inside a function in a DAG."""

    # supported behavior following a raised error
    strict: str = "strict"  # stop the execution of the whole DAG
    all_children: str = "all-children"  # stop the execution of the all successors
    permissive: str = "permissive"  # continue the execution of the whole DAG

Bases: str, Enum

The Resource to use launching ExecNodes inside the DAG scheduler a DAG.

Resource can be either: 1. "thread": Launch the ExecNode in a thread (Default) 2. "main-thread": Launch the ExecNode inside the main thread, directly inside the main scheduler.

Notice that when "main-thread" is used, some of the scheduler functionalities stop working as previously expected: 1. No new ExecNode will be launched during the execution of the corresponding ExecNode 2. If timeout is set on the corresponding ExecNode, it is not guaranteed to work properly.

Source code in tawazi/consts.py
@unique
class Resource(str, Enum):
    """The Resource to use launching ExecNodes inside the DAG scheduler a DAG.

    Resource can be either:
    1. "thread": Launch the ExecNode in a thread (Default)
    2. "main-thread": Launch the ExecNode inside the main thread, directly inside the main scheduler.

    Notice that when "main-thread" is used, some of the scheduler functionalities stop working as previously expected:
    1. No new ExecNode will be launched during the execution of the corresponding ExecNode
    2. If timeout is set on the corresponding ExecNode, it is not guaranteed to work properly.
    """

    # supported behavior following a raised error
    thread: str = "thread"
    main_thread: str = "main-thread"

thread: str = 'thread' class-attribute instance-attribute