Skip to content

Commit

Permalink
Fix MicrobatchModelRunner.on_skip to handle skipping the entire node
Browse files Browse the repository at this point in the history
Previously `MicrobatchModelRunner.on_skip` only handled when a _batch_ of
the model was being skipped. However, that method is also used when the
entire microbatch model is being skipped due to an upstream node error. Because
we previously _weren't_ handling this second case, it'd cause an unhandled
runtime exception. Thus we now need to check whether we're running a batch or not,
and there is no batch, then use the super's on_skip method.
  • Loading branch information
QMalcolm committed Dec 6, 2024
1 parent 9bc3816 commit 0a40352
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,18 +492,22 @@ def merge_batch_results(self, result: RunResult, batch_results: List[RunResult])
result.batch_results.successful += self.node.previous_batch_results.successful

def on_skip(self):
self.print_skip_batch_line()
return RunResult(
node=self.node,
status=RunStatus.Skipped,
timing=[],
thread_id=threading.current_thread().name,
execution_time=0.0,
message="SKIPPED",
adapter_response={},
failures=1,
batch_results=BatchResults(failed=[self.batches[self.batch_idx]]),
)
# If node.batch is None, then we're dealing with skipping of the entire node
if self.node.batch is None:
return super().on_skip()
else:
self.print_skip_batch_line()
return RunResult(
node=self.node,
status=RunStatus.Skipped,
timing=[],
thread_id=threading.current_thread().name,
execution_time=0.0,
message="SKIPPED",
adapter_response={},
failures=1,
batch_results=BatchResults(failed=[self.batches[self.batch_idx]]),
)

def _build_succesful_run_batch_result(
self,
Expand Down

0 comments on commit 0a40352

Please sign in to comment.