Skip to content

API ListDAGs inconsistent with Web View/CLI #16228

Closed

Description

@jpyen

/api/v1/dags lists a total of 39 DAGs, while only 8 DAGs are present which can be seen in the Web UI and Airflow CLI on worker pods.

Any explanation on why I get different results from the API vs all other methods?

It seems that the API is showing deleted DAGs without a present file.

Apache Airflow version: 2.0.1 / 2.1.0

Activity

  1. added
    kind:bug
    on Jun 2, 2021
  2. jpyen commented on Jun 2, 2021

    @jpyen
    ContributorAuthor

    Is it possible that /api/v1/dags is only listing DAGs the current user has access to - present or not?
    https://github.com/apache/airflow/blob/main/airflow/api_connexion/endpoints/dag_endpoint.py#L64

    In contrast the UI seems to get the DAG list ground-truth from here:

    dags_query = session.query(DagModel).filter(~DagModel.is_subdag, DagModel.is_active)

    and then uses get_accessible_dag_ids to only show a selection.

    Is this assessment correct?

  3. uranusjr commented on Jun 2, 2021

    @uranusjr
    Member

    Correct, the index page lists all DAGs by default, while the API only lists those the user has the permission to view (since the API returns DAG details that the user may not have permission to view).

    (Thinking loudly) Maybe we should make this less confusing? For example, the API can instead list all the DAGs, but only show details of those the user has permissions to view; or maybe the web UI should only show DAGs viewable by the user (at least by default).

  4. jpyen commented on Jun 2, 2021

    @jpyen
    ContributorAuthor

    Thanks for the quick reply uranusjr, in this case I would be confused that the API shows more (invalid) DAGs, as in DAGs that have been deleted and should not be visible - even with the right permissions? (Thats as far as I understood the issue)

  5. uranusjr commented on Jun 3, 2021

    @uranusjr
    Member

    I think your understanding is correct. I’m not sure why the API does not filter out inactive DAGs (they probably should show sub-DAGs though I’m not 100% sure), could be an oversight or intetional design. We’ll need someone who was involved in the API implementation to answer this.

  6. added
    area:API
    on Jun 3, 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:APIkind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions