Skip to content

Duplicate dag_id should emit an error #19525

Closed

Description

@MatrixManAtYrService

Apache Airflow version

2.2.2rc1 (release candidate)

Operating System

debian (docker)

Versions of Apache Airflow Providers

n/a

Deployment

Astronomer

Deployment details

Dockerfile:

astro dev start

FROM quay.io/astronomer/ap-airflow-dev:2.2.2-onbuild-48058

Two dags:

# one.py

@task
def a():
    print("a")

@dag(schedule_interval=None, start_date=days_ago(2))
def my_dag():
    a()

dag = my_dag()
# two.py

@task
def b():
    print("b")

@dag(schedule_interval=None, start_date=days_ago(2))
def my_dag():
    b()

dag = my_dag()

Note that they share the same dag_id: my_dag

What happened

Only one DAG appeared. In the tree-view, I would refresh the page and see the task change between:

  • task_id: a
  • task_id: b

seemingly at random.

What you expected to happen

At least, I expected a warning to appear. It seems that we used to have this: #15302

I think that in the presence of a dag_id collision, we should either:

  • refuse to run that dag at all until the collision is resolved
  • resolve it deterministically

How to reproduce

Include the two dags above and observe the "DAGs" view. Notice that there's only one DAG and it's not clear which one it is.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. changed the title [-]Duplicate dag_id should Emit an error[/-] [+]Duplicate dag_id should emit an error[/+] on Nov 10, 2021
  2. eladkal commented on Nov 24, 2021

    @eladkal
    Contributor

    cc @uranusjr seems like edge case of #15302 ?

  3. added this to the Airflow 2.2.3 milestone on Nov 24, 2021
  4. uranusjr commented on Nov 24, 2021

    @uranusjr
    Member

    #15302 only handles duplicated IDs in a DAG processor, not in the entire Airflow setup. That is very difficult to do, as already discussed in depth in #17861 and #17891.

    Closing this as a duplicate.

  5. added
    duplicate
    and removed
    _eol_affected_version:2.2
    on Nov 24, 2021
  6. removed this from the Airflow 2.2.3 milestone on Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreduplicatekind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions