(self, num_workers: Optional[int] = None)
| 9 | |
| 10 | class 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 | """ |
no test coverage detected