From fa57278a797071ac9540943a99cbc06576d0e1f7 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Thu, 17 Oct 2024 15:27:04 -0700 Subject: [PATCH] Reraise `KeyboardInterrupt`s and `SystemExit`s during microbatch model 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. --- core/dbt/task/run.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/dbt/task/run.py b/core/dbt/task/run.py index ce613c0e44d..0b6fae4fc4c 100644 --- a/core/dbt/task/run.py +++ b/core/dbt/task/run.py @@ -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(