New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix API List DAGs inconsistent with UI/CLI #16318
Conversation
There was a problem hiding this comment.
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?
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 |
@@ -387,6 +396,7 @@ def test_should_raise_404_when_dag_is_not_found(self): | |||
class TestGetDags(TestDagEndpoint): | |||
def test_should_respond_200(self): | |||
self._create_dag_models(2) | |||
self._create_deactivated_dag() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
@ephraimbuddy Is it possible to run the full CI suite? |
Once approved, it'll run more tests as needed |
Added @ephraimbuddy suggestions & rebased to master. |
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. |
@kaxil @ephraimbuddy Changes approved, checks passed and ready to merge. Thanks for the patience. |
Thanks @ephraimbuddy! |
Congrats on the PR @jpyen |
related: #16228
/api/v1/dags
should yield the same output as the Web UI and CLI, namely: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.