Airflow TaskFlow: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 16: Line 16:
def some_dag():
def some_dag():
     @task
     @task
     def task_a():
     def task_a(ti=None):
         print(">>> A")
         print(f"executing task A, task instance {ti}")


     @task
     @task
     def task_b():
     def task_b(ti=None):
         print(">>> B")
         print(f"executing task B, task instance {ti}")


     task_a() >> task_b()
     task_a() >> task_b()

Revision as of 02:53, 16 July 2022

External

Internal

Overview

Programming Model

from airflow.decorators import dag, task
from datetime import datetime


@dag(
    [...]
)
def some_dag():
    @task
    def task_a(ti=None):
        print(f"executing task A, task instance {ti}")

    @task
    def task_b(ti=None):
        print(f"executing task B, task instance {ti}")

    task_a() >> task_b()

Context

https://airflow.apache.org/docs/apache-airflow/stable/concepts/taskflow.html#context
https://airflow.apache.org/docs/apache-airflow/stable/templates-ref.html#templates-variables

Logging

https://airflow.apache.org/docs/apache-airflow/stable/concepts/taskflow.html#logging