| :py:mod:`airflow.models.taskmixin` |
| ================================== |
| |
| .. py:module:: airflow.models.taskmixin |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.models.taskmixin.DependencyMixin |
| airflow.models.taskmixin.TaskMixin |
| airflow.models.taskmixin.DAGNode |
| |
| |
| |
| |
| .. py:class:: DependencyMixin |
| |
| Mixing implementing common dependency setting methods methods like >> and <<. |
| |
| .. py:method:: roots(self) |
| :property: |
| |
| List of root nodes -- ones with no upstream dependencies. |
| |
| a.k.a. the "start" of this sub-graph |
| |
| |
| .. py:method:: leaves(self) |
| :property: |
| |
| List of leaf nodes -- ones with only upstream dependencies. |
| |
| a.k.a. the "end" of this sub-graph |
| |
| |
| .. py:method:: set_upstream(self, other) |
| :abstractmethod: |
| |
| Set a task or a task list to be directly upstream from the current task. |
| |
| |
| .. py:method:: set_downstream(self, other) |
| :abstractmethod: |
| |
| Set a task or a task list to be directly downstream from the current task. |
| |
| |
| .. py:method:: update_relative(self, other, upstream=True) |
| |
| Update relationship information about another TaskMixin. Default is no-op. |
| Override if necessary. |
| |
| |
| .. py:method:: __lshift__(self, other) |
| |
| Implements Task << Task |
| |
| |
| .. py:method:: __rshift__(self, other) |
| |
| Implements Task >> Task |
| |
| |
| .. py:method:: __rrshift__(self, other) |
| |
| Called for Task >> [Task] because list don't have __rshift__ operators. |
| |
| |
| .. py:method:: __rlshift__(self, other) |
| |
| Called for Task << [Task] because list don't have __lshift__ operators. |
| |
| |
| |
| .. py:class:: TaskMixin |
| |
| Bases: :py:obj:`DependencyMixin` |
| |
| :meta private: |
| |
| .. py:method:: __init_subclass__(cls) |
| :classmethod: |
| |
| |
| |
| .. py:class:: DAGNode |
| |
| Bases: :py:obj:`DependencyMixin` |
| |
| A base class for a node in the graph of a workflow -- an Operator or a Task Group, either mapped or |
| unmapped. |
| |
| .. py:attribute:: dag |
| :annotation: :Optional[airflow.models.dag.DAG] |
| |
| |
| |
| .. py:attribute:: task_group |
| :annotation: :Optional[airflow.utils.task_group.TaskGroup] |
| |
| The task_group that contains this node |
| |
| |
| .. py:attribute:: start_date |
| :annotation: :Optional[pendulum.DateTime] |
| |
| |
| |
| .. py:attribute:: end_date |
| :annotation: :Optional[pendulum.DateTime] |
| |
| |
| |
| .. py:attribute:: upstream_task_ids |
| :annotation: :Set[str] |
| |
| |
| |
| .. py:attribute:: downstream_task_ids |
| :annotation: :Set[str] |
| |
| |
| |
| .. py:method:: node_id(self) |
| :property: |
| |
| |
| .. py:method:: label(self) |
| :property: |
| |
| |
| .. py:method:: has_dag(self) |
| |
| |
| .. py:method:: dag_id(self) |
| :property: |
| |
| Returns dag id if it has one or an adhoc/meaningless ID |
| |
| |
| .. py:method:: log(self) |
| :property: |
| |
| |
| .. py:method:: roots(self) |
| :property: |
| |
| List of root nodes -- ones with no upstream dependencies. |
| |
| a.k.a. the "start" of this sub-graph |
| |
| |
| .. py:method:: leaves(self) |
| :property: |
| |
| List of leaf nodes -- ones with only upstream dependencies. |
| |
| a.k.a. the "end" of this sub-graph |
| |
| |
| .. py:method:: set_downstream(self, task_or_task_list, edge_modifier = None) |
| |
| Set a node (or nodes) to be directly downstream from the current node. |
| |
| |
| .. py:method:: set_upstream(self, task_or_task_list, edge_modifier = None) |
| |
| Set a node (or nodes) to be directly downstream from the current node. |
| |
| |
| .. py:method:: downstream_list(self) |
| :property: |
| |
| List of nodes directly downstream |
| |
| |
| .. py:method:: upstream_list(self) |
| :property: |
| |
| List of nodes directly upstream |
| |
| |
| .. py:method:: get_direct_relative_ids(self, upstream = False) |
| |
| Get set of the direct relative ids to the current task, upstream or |
| downstream. |
| |
| |
| .. py:method:: get_direct_relatives(self, upstream = False) |
| |
| Get list of the direct relatives to the current task, upstream or |
| downstream. |
| |
| |
| .. py:method:: serialize_for_task_group(self) |
| :abstractmethod: |
| |
| This is used by SerializedTaskGroup to serialize a task group's content. |
| |
| |
| .. py:method:: iter_mapped_dependants(self) |
| |
| Return mapped nodes that depend on the current task the expansion. |
| |
| For now, this walks the entire DAG to find mapped nodes that has this |
| current task as an upstream. We cannot use ``downstream_list`` since it |
| only contains operators, not task groups. In the future, we should |
| provide a way to record an DAG node's all downstream nodes instead. |
| |
| |
| |