1

I am trying to launch a process through the Bash Operator.

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

I know that Airflow uses Pendulum to manage datetimes, so by looking at the documentation, I tried the '.set' method

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

but I get the error 'pendulum.pendulum.Pendulum object' has no attribute 'set'.

I could not find further documentation.

How could I change the hour of the next_execution_date?

Matipedia
  • 15
  • 5

1 Answers1

0

Try this (untested):

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,
    )

Why are you triggering a dag from within a DAG?

Simon D
  • 5,730
  • 2
  • 17
  • 31