Skip to content

Commit

Permalink
Update _BaseWorker to avoid creating a new Pipeline in the main t…
Browse files Browse the repository at this point in the history
…hread
  • Loading branch information
althonos committed Oct 14, 2024
1 parent 2bcb411 commit ea74698
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pyhmmer/hmmer/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ def __init__(
super().__init__()
self.options = options
self.targets: _T = targets
self.pipeline = pipeline_class(**options)
self.pipeline = None
self.pipeline_options = options
self.pipeline_class = pipeline_class
self.query_queue: "queue.Queue[typing.Optional[_BaseChore[_Q, _R]]]" = query_queue
self.query_count = query_count
self.callback: typing.Optional[typing.Callable[[_Q, int], None]] = (
Expand All @@ -265,6 +267,8 @@ def __init__(
self.builder = builder

def run(self) -> None:
if self.pipeline is None:
self.pipeline = self.pipeline_class(**self.pipeline_options)
while not self.is_killed():
# attempt to get the next argument, with a timeout
# so that the thread can periodically check if it has
Expand Down

0 comments on commit ea74698

Please sign in to comment.