Skip to content

Commit

Permalink
Reraise KeyboardInterrupts and SystemExits during microbatch mode…
Browse files Browse the repository at this point in the history
…l execution

Previously we were catching all execptions during microbatch model execution, and gracefully
handling them. This ensured that one failing batch didn't cause the rest of the batches to
fail / be skipped unnecessarily. However if there is a KeyboardInterrupt or SystemExit, execution
should halt. To get this to happen, we're now catching and reraising `KeybaordInterrupts`s and
`SystemExit`s.
  • Loading branch information
QMalcolm committed Oct 17, 2024
1 parent 8be0635 commit a17c3f8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ def _execute_microbatch_materialization(
# Update context vars for future batches
context["is_incremental"] = lambda: True
context["should_full_refresh"] = lambda: False
except (KeyboardInterrupt, SystemExit):
# reraise it for GraphRunnableTask.execute_nodes to handle
raise
except Exception as e:
exception = e
batch_run_result = self._build_failed_run_batch_result(
Expand Down

0 comments on commit a17c3f8

Please sign in to comment.