Skip to content

dispatch_node

Dispatch nodes.

AbstractDispatchTask dataclass

Bases: ABC

A graph execution split node, not to be executed.

Source code in client/ayon_workflow/workflow_editor/dispatch_node.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@dataclass
class AbstractDispatchTask(abc.ABC):
    """A graph execution split node, not to be executed."""

    name: str
    label: Optional[str] = None
    class_name: Optional[str] = None
    node_names: List[str] = field(default_factory=list)
    task_chunk: Optional[TaskChunkParameters] = None

    ui: Optional[ui_utils.UiNodeMetadata] = None
    metadata: Dict[str, Any] = field(default_factory=dict)

    @property
    def node_type(self) -> str:
        return self.__class__.__name__

    def __str__(self) -> str:
        return f"<{self.node_type} {self.label}>"

    @staticmethod
    def get_associated_manager() -> str:
        """The manager associated to the dispatch task."""
        raise NotImplementedError("abstract method")

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "AbstractDispatchTask":
        if data.get("task_chunk") and not isinstance(
            data["task_chunk"], TaskChunkParameters
        ):
            data["task_chunk"] = TaskChunkParameters(**data["task_chunk"])

        # Backward compatibility, dispatch task used to
        # contain all nodes are entire object instead of just names.
        if data.get("nodes") and not data.get("node_names"):
            data["node_names"] = [
                node.get("name")
                for node in data.pop("nodes")
            ]

        return cls(
            name=data.pop("name"),
            label=data.pop("label", None),
            **data,
        )

get_associated_manager() staticmethod

The manager associated to the dispatch task.

Source code in client/ayon_workflow/workflow_editor/dispatch_node.py
39
40
41
42
@staticmethod
def get_associated_manager() -> str:
    """The manager associated to the dispatch task."""
    raise NotImplementedError("abstract method")

DeadlineThinkbox dataclass

Bases: AbstractDispatchTask

A split node associated to Deadline Thinkbox.

Source code in client/ayon_workflow/workflow_editor/dispatch_node.py
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@dataclass
class DeadlineThinkbox(AbstractDispatchTask):
    """A split node associated to Deadline Thinkbox."""

    # TODO: this should be moved to ayon-deadline at some point
    job_name: Optional[str] = None
    priority: Optional[int] = None
    pool: Optional[str] = None
    group: Optional[str] = None
    limit_groups: Optional[List[str]] = field(default_factory=list)
    override_task_failure: Optional[bool] = False
    task_failure_detection: Optional[int] = 0  # no detection
    username: Optional[str] = None
    comment: Optional[str] = None

    @staticmethod
    def get_associated_manager() -> str:
        return "Deadline Thinkbox"

GenericDispatchTask dataclass

Bases: AbstractDispatchTask

A generic split node.

Source code in client/ayon_workflow/workflow_editor/dispatch_node.py
66
67
68
69
70
71
class GenericDispatchTask(AbstractDispatchTask):
    """A generic split node."""

    @staticmethod
    def get_associated_manager() -> str:
        return "AYON"

RoyalRender dataclass

Bases: AbstractDispatchTask

A split node associated to RoyalRender.

Source code in client/ayon_workflow/workflow_editor/dispatch_node.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
@dataclass
class RoyalRender(AbstractDispatchTask):
    """A split node associated to RoyalRender."""

    # TODO: this should be moved to ayon-royalrender at some point
    job_name: Optional[str] = None
    priority: Optional[int] = None
    username: Optional[str] = None
    required_license: Optional[str] = None
    required_plugin: Optional[str] = None

    @staticmethod
    def get_associated_manager() -> str:
        return "RoyalRender"

TaskChunkParameters dataclass

A graph execution split node, not to be executed.

Source code in client/ayon_workflow/workflow_editor/dispatch_node.py
11
12
13
14
15
16
@dataclass
class TaskChunkParameters:
    """A graph execution split node, not to be executed."""
    node_name: str
    node_input_name: str
    chunk_size: int = 1

get_dispatch_node_types()

Return the available node types.

Source code in client/ayon_workflow/workflow_editor/dispatch_node.py
110
111
112
113
114
def get_dispatch_node_types() -> List[Any]:
    """Return the available node types."""
    # TODO: this should be a dynamic discovery once those
    # metadata container are moved to their respective addons.
    return [GenericDispatchTask, DeadlineThinkbox, RoyalRender]