-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite execution of microbatch models to avoid blocking the main thr…
…ead (#11332) * Push orchestration of batches previously in the `RunTask` into `MicrobatchModelRunner` * Split `MicrobatchModelRunner` into two separate runners `MicrobatchModelRunner` is now an orchestrator of `MicrobatchBatchRunner`s, the latter being what handle actual batch execution * Introduce new `DbtThreadPool` that knows if it's been closed * Enable `MicrobatchModelRunner` to shutdown gracefully when it detects the thread pool has been closed
- Loading branch information
Showing
9 changed files
with
445 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Fix microbatch execution to not block main thread nor hang | ||
time: 2025-03-03T13:14:40.432874-06:00 | ||
custom: | ||
Author: QMalcolm | ||
Issue: 11243 11306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
from multiprocessing.pool import ThreadPool | ||
|
||
|
||
class DbtThreadPool(ThreadPool): | ||
"""A ThreadPool that tracks whether or not it's been closed""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.closed = False | ||
|
||
def close(self): | ||
self.closed = True | ||
super().close() | ||
|
||
def is_closed(self): | ||
return self.closed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.