【问题标题】:Change time of 'next_execution_date' on Airflow in 'BashOperator'在“BashOperator”中更改 Airflow 上“next_execution_date”的时间
【发布时间】:2020-01-30 13:38:54
【问题描述】:

我正在尝试通过 Bash Operator 启动一个进程。

bash =BashOperator(
        task_id='Trigger some dag',
        bash_command='airflow trigger_dag -e "{{ next_execution_date }}" some_dag_id',
        dag=dag,
    )

我知道 Airflow 使用 Pendulum 来管理日期时间,所以通过查看文档,我尝试了 '.set' 方法

bash =BashOperator(
        task_id='Trigger some dag',
        bash_command='airflow trigger_dag -e "{{ next_execution_date.set(hour=someHour) }}" some_dag_id',
        dag=dag,
    )

但我收到错误 'pendulum.pendulum.Pendulum object' has no attribute 'set'

我找不到更多文档。

如何更改 next_execution_date 的小时数?

【问题讨论】:

    标签: python-3.x airflow pendulum


    【解决方案1】:

    试试这个(未经测试):

    bash =BashOperator(
            task_id='Trigger some dag',
            bash_command='airflow trigger_dag -e "{{ macros.ds_add(next_execution_date, 1)}}" some_dag_id',
            dag=dag,
        )
    

    为什么要从 DAG 中触发 dag?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-28
      • 1970-01-01
      • 1970-01-01
      • 2017-06-28
      • 1970-01-01
      • 2022-10-31
      • 2018-11-20
      相关资源
      最近更新 更多