Skip to content
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 query bug in next_run_datasets_summary endpoint #34143

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,8 @@ def next_run_datasets_summary(self, session: Session = NEW_SESSION):
filter_dag_ids = allowed_dag_ids

dataset_triggered_dag_ids = [
dag.dag_id
for dag in (
dag_id
for dag_id in (
session.scalars(
select(DagModel.dag_id)
.where(DagModel.dag_id.in_(filter_dag_ids))
Expand Down
11 changes: 11 additions & 0 deletions tests/www/views/test_views_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,14 @@ def test_should_return_max_if_req_above(self, admin_client, session):

assert response.status_code == 200
assert len(response.json["datasets"]) == 50


class TestGetDatasetNextRunSummary(TestDatasetEndpoint):
def test_next_run_dataset_summary(self, dag_maker, admin_client):
with dag_maker(dag_id="upstream", schedule=[Dataset(uri="s3://bucket/key/1")], serialized=True):
EmptyOperator(task_id="task1")

response = admin_client.post("/next_run_datasets_summary", data={"dag_ids": ["upstream"]})

assert response.status_code == 200
assert response.json == {"upstream": {"ready": 0, "total": 1, "uri": "s3://bucket/key/1"}}