Skip to content

Fix API List DAGs inconsistent with UI/CLI - #16318

Merged
ephraimbuddy merged 9 commits into
apache:mainfrom
jpyen:api-16228
Jun 10, 2021
Merged

ephraimbuddy merged 9 commits into
apache:mainfrom
jpyen:api-16228

Conversation

@jpyen

@jpyen jpyen commented Jun 8, 2021

Copy link
Copy Markdown
Contributor

related: #16228

/api/v1/dags should yield the same output as the Web UI and CLI, namely:

  • show all dags
  • that the user has access to
  • which are present as DAG (can be scheduled, source file available)

The current implementation does only list DAGs that the user has access to, but fails to get the true DAG bag list. Which means the API endpoint is showing many more, deleted DAGs, that the UI and Web CLI do not.

@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Jun 8, 2021

@ephraimbuddy ephraimbuddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test to avoid regression?

@jpyen

jpyen commented Jun 8, 2021

Copy link
Copy Markdown
Contributor Author

Can you add a test to avoid regression?

Sure thing, although I am not too sure how to reproduce this state/ explicitly test for this state. Do you have any recommendation?

@ephraimbuddy

Copy link
Copy Markdown
Contributor

Can you add a test to avoid regression?

Sure thing, although I am not too sure how to reproduce this state/ explicitly test for this state. Do you have any recommendation?

I think you can achieve it by marking dag inactive. DagModel.is_active exists, so many mark a dag inactive and another active

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about you add a query that asserts that the number of dags in DagModel is 3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number of DAGs in DagModel should exclude inactive DAGs, as far as I understand. In my opinion are inactive DAGs .trash and play no significant role.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know but how are we sure that an inactive dag exists here? Do we have a test for the new method you created? I think that querying DagModel and asserting that it has 3 dags(both active and inactive) at this point will help to know that the method you created works fine. If there's an alteration in the method in the future to work another way, it'll be noticed. What do you think?

@jpyen

jpyen commented Jun 9, 2021

Copy link
Copy Markdown
Contributor Author

@ephraimbuddy Is it possible to run the full CI suite?

@ephraimbuddy

ephraimbuddy commented Jun 9, 2021 •

Copy link
Copy Markdown
Contributor

@ephraimbuddy Is it possible to run the full CI suite?

Once approved, it'll run more tests as needed

@kaxil kaxil closed this Jun 9, 2021
@kaxil kaxil reopened this Jun 9, 2021
@jpyen

jpyen commented Jun 9, 2021

Copy link
Copy Markdown
Contributor Author

Added @ephraimbuddy suggestions & rebased to master.

@jpyen
jpyen requested a review from ephraimbuddy June 10, 2021 01:27
@jpyen jpyen closed this Jun 10, 2021
@jpyen jpyen reopened this Jun 10, 2021
@jpyen jpyen closed this Jun 10, 2021
@jpyen jpyen reopened this Jun 10, 2021
@github-actions

Copy link
Copy Markdown
Contributor

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions Bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jun 10, 2021
@jpyen

jpyen commented Jun 10, 2021 •

Copy link
Copy Markdown
Contributor Author

@kaxil @ephraimbuddy Changes approved, checks passed and ready to merge. Thanks for the patience.

@ephraimbuddy ephraimbuddy self-assigned this Jun 10, 2021
@ephraimbuddy
ephraimbuddy merged commit 9ba796e into apache:main Jun 10, 2021
@jpyen

jpyen commented Jun 10, 2021

Copy link
Copy Markdown
Contributor Author

Thanks @ephraimbuddy!

@ephraimbuddy

Copy link
Copy Markdown
Contributor

Congrats on the PR @jpyen

@ashb ashb added this to the Airflow 2.1.1 milestone Jun 16, 2021
ashb pushed a commit that referenced this pull request Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API okay to merge It's ok to merge this PR as it does not require more tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants