snowflake.core.task.dagv1.DAGTaskΒΆ
- class snowflake.core.task.dagv1.DAGTask(name: str, definition: str | Callable[[...], Any] | StoredProcedureCall, *, condition: str | None = None, warehouse: str | None = None, session_parameters: dict[str, Any] | None = None, user_task_managed_initial_warehouse_size: str | None = None, target_completion_interval: timedelta | None = None, serverless_task_min_statement_size: str | None = None, serverless_task_max_statement_size: str | None = None, user_task_timeout_ms: int | None = None, error_integration: str | None = None, comment: str | None = None, is_finalizer: bool | None = None, is_serverless: bool = False, dag: DAG | None = None)ΒΆ
Bases:
object
Represents a child Task of a task graph.
A child task has a subset of properties of
snowflake.core.task.Task
. For instance, it doesnβt haveschedule
because itβs triggered after the predecessors are finished.- Parameters:
is_finalizer (bool, optional) β Whether this child task is a finalizer task for the DAG.
is_serverless (bool) β Whether the child task is serverless. If set, no warehouse can be specified for the task. If not set and no warehouse is specified for the child Task, then the warehouse setting is inherited from the root Task. This means that if both the child Task and its DAG do not have a warehouse specified then the child Task will be created as serverless even if is_serverless is set to False. Default is False.
dag (DAG, optional) β The DAG this child Task belong to.
Refer to
snowflake.core.task.Task
for the details of the remaining properties.Attributes
- full_nameΒΆ
The full name of the child task.
- predecessorsΒΆ
Return the predecessors of the Task.
Methods
- add_predecessors(other: DAGTask | Iterable[DAGTask | Callable[[Session], str | None]] | Callable[[Session], str | None]) None ΒΆ
Add a task or a task list to the direct predecessors of the current task.
- Parameters:
other (Union[DAGTask, Iterable[DAGTask], Callable[["Session"], Optional[str]]]) β The task or task list to be added as the direct predecessors of the current task.
Examples
Add a task to the predecessors of the current task:
>>> task1 = DAGTask("task1", "select 'task1'") >>> task2 = DAGTask("task2", "select 'task2'") >>> task1.add_predecessors(task2)
- add_successors(other: DAGTask | Iterable[DAGTask | Callable[[Session], str | None]] | Callable[[Session], str | None]) None ΒΆ
Add a task or a task list to be the direct successor of the current task.
- Parameters:
other (Union[DAGTask, Iterable[DAGTask], Callable[["Session"], Optional[str]]]) β The task or task list to be added as the direct successors of the current task.
Examples
Add a task to the successors of the current task:
>>> task1 = DAGTask("task1", "select 'task1'") >>> task2 = DAGTask("task2", "select 'task2'") >>> task1.add_successors(task2)