MCPcopy Create free account
hub / github.com/LukeBailey181/sgs / launch_workers

Method launch_workers

sgs/models/query_server.py:11–36  ·  view source on GitHub ↗
(self, num_workers: Optional[int] = None)

Source from the content-addressed store, hash-verified

9
10class QueryServer(TaskServer):
11 def launch_workers(self, num_workers: Optional[int] = None) -> None:
12 if self._tasks.qsize() == 0 and len(self._in_progress) == 0:
13 raise ValueError(
14 "There is no work to be done and you are trying to launch jobs."
15 )
16
17 resources_config = self.worker_resources_config
18 if not resources_config.submitit:
19 return
20
21 executor = get_submitit_executor(resources_config)
22
23 if num_workers is None:
24 num_workers = resources_config.num_jobs
25
26 assert self.model_config is not None, "Model config must be set for QueryServer"
27 for _ in range(num_workers):
28 worker = QueryWorkerToServerTask(
29 self.server_address, monitor=self.in_depth_monitoring
30 )
31 job = executor.submit(
32 worker,
33 model_config=self.model_config,
34 buffer_size=self.model_config.gen_batch_size,
35 )
36 self.workers.append(job)
37
38 def launch_master_worker(self) -> None:
39 """

Callers 1

query_model_batchFunction · 0.45

Calls 2

get_submitit_executorFunction · 0.90

Tested by

no test coverage detected