【发布时间】:2022-06-15 23:25:56
【问题描述】:
我以与these Airflow docs 非常相似的方式将一些运行时 DAG 参数/配置传递给 PythonOperator:
def print_x(x):
print(f"x is {x}")
with DAG(
"print_x",
start_date=pendulum.datetime(2022, 6, 15, tz="UTC"),
schedule_interval=None,
catchup=False,
params={
"x": Param(42),
},
) as dag:
PythonOperator(
task_id="print_x",
op_kwargs={
"x": "{{ params.x }}",
},
python_callable=print_x,
)
但是当我手动触发 DAG 时,无论我在“触发 DAG”对话框中输入了什么,我总是得到默认值 (42)。
这里出了什么问题?
注意:在我的特殊情况下,我在 AWS Managed Workflows for Apache Airflow (MWAA) 上运行 Airflow 2.2.2,但我认为这不相关。
【问题讨论】:
标签: airflow airflow-2.x