airflow TriggerDagRunOperator how to change the execution date

后端 未结 4 1727
无人共我
无人共我 2020-12-31 17:29

I noticed that for scheduled task the execution date is set in the past according to

Airflow was developed as a solution for ETL needs. In the ETL wo

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 18:06

    The TriggerDagRunOperator now has an execution_date parameter to set the execution date of the triggered run. Unfortunately the parameter is not in the template fields. If it will be added to template fields (or if you override the operator and change the template_fields value) it will be possible to use it like this:

    my_trigger_task= TriggerDagRunOperator(task_id='my_trigger_task',
                                                  trigger_dag_id="triggered_dag_id",
                                                  python_callable=conditionally_trigger,
                                                  execution_date= '{{execution_date}}',
                                                  dag=dag)
    

    It has not been released yet but you can see the sources here: https://github.com/apache/incubator-airflow/blob/master/airflow/operators/dagrun_operator.py

    The commit that did the change was: https://github.com/apache/incubator-airflow/commit/089c996fbd9ecb0014dbefedff232e8699ce6283#diff-41f9029188bd5e500dec9804fed26fb4

提交回复
热议问题