Skip to content

TriggerDagRunOperator raises a DeprecationWarning #23124

@sp1thas

Description

@sp1thas

Apache Airflow version

2.2.5 (latest released)

What happened

When I'm using the airflow.operators.trigger_dagrun.TriggerDagRunOperator, the following DeprecationWarning is raised:

[2022-04-20 17:59:09,618] {logging_mixin.py:109} WARNING - /usr/local/lib/python3.9/site-packages/airflow/api/common/trigger_dag.py:84 DeprecationWarning: Calling `DAG.create_dagrun()` without an explicit data interval is deprecated

What you think should happen instead

Run the DAG without raising any warnings.

How to reproduce

Given the following two DAGs:

from datetime import datetime

from airflow import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.trigger_dagrun import TriggerDagRunOperator

dag_a = DAG(
    dag_id='a',
    start_date=datetime(2021, 10, 21),
    schedule_interval='30 4 * * *',
    catchup=False,
)

with dag_a:
    task_a = DummyOperator(task_id='foo')

dag_a_yesterday = DAG(
    dag_id='a_yesterday',
    start_date=datetime(2021, 10, 21),
    schedule_interval='@once',
    catchup=False,
)

with dag_a_yesterday:
    task_b = TriggerDagRunOperator(
        task_id='trigger_dag_a_yesterday',
        trigger_dag_id='a',
        wait_for_completion=True,
        execution_date='{{ data_interval_start.subtract(days=1, minutes=-1) }}'
    )

and after triggering the a_yesterday DAG:

$ astro airflow run dags trigger a_yesterday -e '2022-04-20 00:00:01'

I'm getting the following warning:

$ docker exec -it webserver tail -n 10 /usr/local/airflow/logs/a_yesterday/trigger_dag_a_yesterday/2022-04-20T00:00:01+00:00/1.log
AIRFLOW_CTX_DAG_ID=a_yesterday
AIRFLOW_CTX_TASK_ID=trigger_dag_a_yesterday
AIRFLOW_CTX_EXECUTION_DATE=2022-04-20T00:00:01+00:00
AIRFLOW_CTX_DAG_RUN_ID=manual__2022-04-20T00:00:01+00:00
[2022-04-20 17:59:09,618] {logging_mixin.py:109} WARNING - /usr/local/lib/python3.9/site-packages/airflow/api/common/trigger_dag.py:84 DeprecationWarning: Calling `DAG.create_dagrun()` without an explicit data interval is deprecated
[2022-04-20 17:59:09,662] {trigger_dagrun.py:178} INFO - Waiting for a on 2022-04-19T00:01:01+00:00 to become allowed state ['success'] ...
[2022-04-20 18:00:09,768] {trigger_dagrun.py:178} INFO - Waiting for a on 2022-04-19T00:01:01+00:00 to become allowed state ['success'] ...
[2022-04-20 18:01:09,871] {trigger_dagrun.py:178} INFO - Waiting for a on 2022-04-19T00:01:01+00:00 to become allowed state ['success'] ...
[2022-04-20 18:02:09,977] {trigger_dagrun.py:178} INFO - Waiting for a on 2022-04-19T00:01:01+00:00 to become allowed state ['success'] ...
[2022-04-20 18:03:10,080] {trigger_dagrun.py:178} INFO - Waiting for a on 2022-04-19T00:01:01+00:00 to become allowed state ['success'] ...

Operating System

Pop!_OS 20.04 LTS

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==1!3.2.0
apache-airflow-providers-cncf-kubernetes==1!3.0.0
apache-airflow-providers-elasticsearch==1!2.2.0
apache-airflow-providers-ftp==1!2.1.2
apache-airflow-providers-google==1!6.7.0
apache-airflow-providers-http==1!2.1.2
apache-airflow-providers-imap==1!2.2.3
apache-airflow-providers-microsoft-azure==1!3.7.2
apache-airflow-providers-mysql==1!2.2.3
apache-airflow-providers-postgres==1!4.1.0
apache-airflow-providers-redis==1!2.0.4
apache-airflow-providers-slack==1!4.2.3
apache-airflow-providers-sqlite==1!2.1.3
apache-airflow-providers-ssh==1!2.4.3

Deployment

Astronomer

Deployment details

docker-compose version 1.29.2, build 5becea4c
Docker version 20.10.14, build a224086
Astronomer docker image: quay.io/astronomer/ap-airflow:2.2.5-2-onbuild

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions