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 30, 2024
1 parent e8d6155 commit fa57278
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 @@ -568,6 +568,9 @@ def _execute_microbatch_materialization(
# At least one batch has been inserted successfully!
incremental_batch = True

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 fa57278

Please sign in to comment.