From 0c964727a846fb753673d154e336d6d4155cc39a Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Mon, 9 Dec 2024 15:05:51 -0600 Subject: [PATCH 1/4] Update partial success test to assert partial successes mean that the run failed --- tests/functional/microbatch/test_microbatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/microbatch/test_microbatch.py b/tests/functional/microbatch/test_microbatch.py index 6d3eb960b76..4769a202d8e 100644 --- a/tests/functional/microbatch/test_microbatch.py +++ b/tests/functional/microbatch/test_microbatch.py @@ -613,7 +613,7 @@ def models(self): def test_run_with_event_time(self, project): # run all partitions from start - 2 expected rows in output, one failed with patch_microbatch_end_time("2020-01-03 13:57:00"): - _, console_output = run_dbt_and_capture(["run"]) + _, console_output = run_dbt_and_capture(["run"], expect_pass=False) assert "PARTIAL SUCCESS (2/3)" in console_output assert "Completed with 1 partial success" in console_output From 59586771c5df17a30fdb4055ec241a7c9a0c7b43 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Mon, 9 Dec 2024 15:06:13 -0600 Subject: [PATCH 2/4] Update results interpretation to include `PartialSuccess` as failure status --- core/dbt/task/runnable.py | 1 + 1 file changed, 1 insertion(+) diff --git a/core/dbt/task/runnable.py b/core/dbt/task/runnable.py index b889558d048..55342cafbbc 100644 --- a/core/dbt/task/runnable.py +++ b/core/dbt/task/runnable.py @@ -626,6 +626,7 @@ def interpret_results(cls, results): NodeStatus.Error, NodeStatus.Fail, NodeStatus.Skipped, # propogate error message causing skip + NodeStatus.PartialSuccess, # because partial success also means partial failure ) ] return len(failures) == 0 From dd537fbe3efaf123ef4a21aecffb11d5b7a5ff69 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Mon, 9 Dec 2024 15:07:19 -0600 Subject: [PATCH 3/4] Add changie doc --- .changes/unreleased/Fixes-20241209-150711.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20241209-150711.yaml diff --git a/.changes/unreleased/Fixes-20241209-150711.yaml b/.changes/unreleased/Fixes-20241209-150711.yaml new file mode 100644 index 00000000000..a9522145abe --- /dev/null +++ b/.changes/unreleased/Fixes-20241209-150711.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix interpretation of `PartialSuccess` to result in non-zero exit code +time: 2024-12-09T15:07:11.391313-06:00 +custom: + Author: QMalcolm + Issue: "11114" From ad566ba25b99d12fdf3edb790ab592e81f099555 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Tue, 10 Dec 2024 09:24:54 -0600 Subject: [PATCH 4/4] Fix `TestMicrobatchMultipleRetries` and `TestMicrobatchSecondBatchFailure` tests --- tests/functional/microbatch/test_microbatch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/microbatch/test_microbatch.py b/tests/functional/microbatch/test_microbatch.py index 4769a202d8e..1d040c332ad 100644 --- a/tests/functional/microbatch/test_microbatch.py +++ b/tests/functional/microbatch/test_microbatch.py @@ -652,7 +652,7 @@ def models(self): def test_run_with_event_time(self, project): # run all partitions from start - 2 expected rows in output, one failed with patch_microbatch_end_time("2020-01-03 13:57:00"): - _, console_output = run_dbt_and_capture(["run"]) + _, console_output = run_dbt_and_capture(["run"], expect_pass=False) assert "PARTIAL SUCCESS (2/3)" in console_output assert "Completed with 1 partial success" in console_output @@ -751,7 +751,7 @@ def test_run_with_event_time(self, project): # run all partitions from start - 2 expected rows in output, one failed with patch_microbatch_end_time("2020-01-03 13:57:00"): - run_dbt(["run"], callbacks=[event_catcher.catch]) + run_dbt(["run"], expect_pass=False, callbacks=[event_catcher.catch]) assert len(event_catcher.caught_events) == 1 self.assert_row_count(project, "microbatch_model", 2)