import DAG from airflow.operators.bash import BashOperator with DAG( dag_id="exercise_02", description="A simple tutorial DAG", schedule="0 * * * *", # schedule_interval="0 * * * *", # Airflow 2.4未満の場合 start_date=datetime.datetime(2021, 1, 1), tags=["example"], ) as dag: @dag.task def compute_random_number(): import random num = random.randint(1, 10) return num random_number = compute_random_number() bash_task_1 = BashOperator( task_id="bash_task_1", bash_command="echo 'random number: {{ ti.xcom_pull(\"compute_random_number\") }}'", ) bash_task_2 = BashOperator( task_id="bash_task_2", bash_command="echo 'message: {{ dag_run.conf[\"message\"] }}'", ) random_number >> bash_task_1 >> bash_task_2 16 Templates reference