MCPcopy Index your code
hub / github.com/python/cpython / start_workers

Method start_workers

Lib/test/libregrtest/run_workers.py:500–519  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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()

Callers 1

runMethod · 0.95

Calls 7

WorkerThreadClass · 0.85
countFunction · 0.85
pluralFunction · 0.85
format_durationFunction · 0.85
get_jobsMethod · 0.80
logMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected