Commit 93c424aa authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

comment get_run_id

parent 4b5cfb90
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
from airflow.providers.standard.operators.python import PythonOperator


def get_run_id(**context):
    # 从上下文中直接获取 dag_run_id
    current_run_id = context["dag_run"].run_id
    print(f"Current run_id: {current_run_id}")


get_run_id_task = PythonOperator(
    task_id="get_dag_run_id",
    python_callable=get_run_id,
    provide_context=True,  # Airflow 2.x 默认启用,可省略
)
#
# def get_run_id(**context):
#     # 从上下文中直接获取 dag_run_id
#     current_run_id = context["dag_run"].run_id
#     print(f"Current run_id: {current_run_id}")
#
#
# get_run_id_task = PythonOperator(
#     task_id="get_dag_run_id",
#     python_callable=get_run_id,
#     provide_context=True,  # Airflow 2.x 默认启用,可省略
# )