Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Nov 15, 2024
1 parent 7c5f178 commit 21fd256
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Lib/test/libregrtest/run_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,25 +501,17 @@ def __init__(self, num_workers: int, runtests: RunTests,
self.worker_timeout: float | None = min(self.timeout * 1.5, self.timeout + 5 * 60)
else:
self.worker_timeout = None
self._workers: list[WorkerThread] | None = None
self.workers: list[WorkerThread] = []

jobs = self.runtests.get_jobs()
if jobs is not None:
# Don't spawn more threads than the number of jobs:
# these worker threads would never get anything to do.
self.num_workers = min(self.num_workers, jobs)

@property
def workers(self) -> list[WorkerThread]:
if self._workers is None:
raise ValueError(
'Should never call `.workers` before `.start_workers()`',
)
return self._workers

def start_workers(self) -> None:
self._workers = [WorkerThread(index, self)
for index in range(1, self.num_workers + 1)]
self.workers = [WorkerThread(index, self)
for index in range(1, self.num_workers + 1)]
jobs = self.runtests.get_jobs()
if jobs is not None:
tests = count(jobs, 'test')
Expand Down

0 comments on commit 21fd256

Please sign in to comment.