(self)
| 498 | self.num_workers = min(self.num_workers, jobs) |
| 499 | |
| 500 | def start_workers(self) -> None: |
| 501 | self.workers = [WorkerThread(index, self) |
| 502 | for index in range(1, self.num_workers + 1)] |
| 503 | jobs = self.runtests.get_jobs() |
| 504 | if jobs is not None: |
| 505 | tests = count(jobs, 'test') |
| 506 | else: |
| 507 | tests = 'tests' |
| 508 | nworkers = len(self.workers) |
| 509 | processes = plural(nworkers, "process", "processes") |
| 510 | msg = (f"Run {tests} in parallel using " |
| 511 | f"{nworkers} worker {processes}") |
| 512 | if self.timeout and self.worker_timeout is not None: |
| 513 | msg += (" (timeout: %s, worker timeout: %s)" |
| 514 | % (format_duration(self.timeout), |
| 515 | format_duration(self.worker_timeout))) |
| 516 | self.log(msg) |
| 517 | for worker in self.workers: |
| 518 | worker.start() |
| 519 | self.live_worker_count += 1 |
| 520 | |
| 521 | def stop_workers(self) -> None: |
| 522 | start_time = time.monotonic() |
no test coverage detected