Skip to content

Commit

Permalink
fix: logic around failed pipelines (#2825)
Browse files Browse the repository at this point in the history
* fix: logic around failed pipelines

* fix: tests
  • Loading branch information
niross authored Oct 26, 2023
1 parent b87a984 commit 1e910c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions dataworkspace/dataworkspace/apps/datasets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,7 @@ def get_pipeline_last_success_date(self):
return get_pipeline_last_success_date(pipeline_name)

def pipeline_last_run_success(self):
last_state = self.get_pipeline_last_run_state()
return last_state == "success" if last_state is not None else None
return self.get_pipeline_last_run_state() in ["success", None]


class SourceTableFieldDefinition(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion dataworkspace/dataworkspace/apps/datasets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def _get_context_data_for_master_dataset(self, ctx, **kwargs):
and subscription.first().is_active(),
"details": subscription.first(),
},
"all_pipeline_last_runs_succeeded": all(
"show_pipeline_failed_message": not all(
(x.pipeline_last_run_succeeded for x in master_datasets_info)
),
}
Expand Down
2 changes: 1 addition & 1 deletion dataworkspace/dataworkspace/tests/datasets/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5024,7 +5024,7 @@ def test_master_dataset_detail_page_shows_pipeline_failures(client, metadata_db)
url = reverse("datasets:dataset_detail", args=(dataset.id,))
response = client.get(url)
assert response.status_code == 200
assert not response.context["all_pipeline_last_runs_succeeded"]
assert response.context["show_pipeline_failed_message"]
assert (
len(
[
Expand Down

0 comments on commit 1e910c8

Please sign in to comment.