Skip to content

Commit

Permalink
Fix microbatch model PartialSuccess status to result in non-zero ex…
Browse files Browse the repository at this point in the history
…it code (#11115) (#11118)

* Update partial success test to assert partial successes mean that the run failed

* Update results interpretation to include `PartialSuccess` as failure status

(cherry picked from commit 983cbb4)

Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and QMalcolm authored Dec 10, 2024
1 parent 92a5548 commit f7ab487
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241209-150711.yaml
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/microbatch/test_microbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit f7ab487

Please sign in to comment.