ray_gpu_executor.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. import asyncio
  2. import os
  3. from collections import defaultdict
  4. from itertools import islice, repeat
  5. from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
  6. from loguru import logger
  7. from aphrodite.common.sequence import ExecuteModelRequest, SamplerOutput
  8. from aphrodite.common.utils import (_run_task_with_lock,
  9. get_aphrodite_instance_id,
  10. get_distributed_init_method, get_ip,
  11. get_open_port, make_async)
  12. from aphrodite.executor.distributed_gpu_executor import ( # yapf: disable
  13. DistributedGPUExecutor, DistributedGPUExecutorAsync)
  14. from aphrodite.executor.ray_utils import RayWorkerWrapper, ray
  15. if ray is not None:
  16. from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
  17. if TYPE_CHECKING:
  18. from ray.util.placement_group import PlacementGroup
  19. # If the env var is set, it uses the Ray's compiled DAG API
  20. # which optimizes the control plane overhead.
  21. # Run Aphrodite with APHRODITE_USE_RAY_COMPILED_DAG=1 to enable it.
  22. APHRODITE_USE_RAY_COMPILED_DAG = bool(
  23. os.getenv("APHRODITE_USE_RAY_COMPILED_DAG", 0))
  24. APHRODITE_TRACE_FUNCTION = int(os.getenv("APHRODITE_TRACE_FUNCTION", 0))
  25. APHRODITE_USE_RAY_SPMD_WORKER = bool(
  26. os.getenv("APHRODITE_USE_RAY_SPMD_WORKER", 0))
  27. APHRODITE_USE_RAY_COMPILED_DAG_NCCL_CHANNEL = bool(
  28. int(os.getenv("APHRODITE_USE_RAY_COMPILED_DAG_NCCL_CHANNEL", 1)))
  29. class RayGPUExecutor(DistributedGPUExecutor):
  30. uses_ray: bool = True
  31. def _init_executor(self) -> None:
  32. self.forward_dag: Optional["ray.dag.CompiledDAG"] = None
  33. # If the env var is set, it uses the Ray's compiled DAG API
  34. # which optimizes the control plane overhead.
  35. # Run Aphrodite with APHRODITE_USE_RAY_COMPILED_DAG=1 to enable it.
  36. # Currently, this requires USE_RAY_SPMD_WORKER=True.
  37. self.use_ray_compiled_dag = APHRODITE_USE_RAY_COMPILED_DAG
  38. # If the env var is set, then we do not distinguish between the
  39. # "driver worker" vs other workers. Also, the rank 0 worker will
  40. # be executed in a remote Ray worker. Currently this requires
  41. # USE_RAY_COMPILED_DAG=True.
  42. self.use_ray_spmd_worker = APHRODITE_USE_RAY_SPMD_WORKER
  43. if self.use_ray_compiled_dag:
  44. assert self.use_ray_spmd_worker, (
  45. "APHRODITE_USE_RAY_COMPILED_DAG=1 requires "
  46. "APHRODITE_USE_RAY_SPMD_WORKER=1")
  47. if self.use_ray_spmd_worker:
  48. # TODO: Support SPMD worker for non-DAG Ray executor.
  49. assert self.use_ray_compiled_dag, (
  50. "APHRODITE_USE_RAY_SPMD_WORKER=1 requires "
  51. "APHRODITE_USE_RAY_COMPILED_DAG=1")
  52. assert self.uses_ray
  53. placement_group = self.parallel_config.placement_group
  54. # Disable Ray usage stats collection.
  55. ray_usage = os.environ.get("RAY_USAGE_STATS_ENABLED", "0")
  56. if ray_usage != "1":
  57. os.environ["RAY_USAGE_STATS_ENABLED"] = "0"
  58. # Create the parallel GPU workers.
  59. self._init_workers_ray(placement_group)
  60. def shutdown(self) -> None:
  61. if hasattr(self, "forward_dag") and self.forward_dag is not None:
  62. self.forward_dag.teardown()
  63. import ray
  64. for worker in self.workers:
  65. ray.kill(worker)
  66. self.forward_dag = None
  67. def _configure_ray_workers_use_nsight(self,
  68. ray_remote_kwargs) -> Dict[str, Any]:
  69. # If nsight profiling is enabled, we need to set the profiling
  70. # configuration for the ray workers as runtime env.
  71. runtime_env = ray_remote_kwargs.setdefault("runtime_env", {})
  72. runtime_env.update({
  73. "nsight": {
  74. "t": "cuda,cudnn,cublas",
  75. "o": "'worker_process_%p'",
  76. "cuda-graph-trace": "node",
  77. }
  78. })
  79. return ray_remote_kwargs
  80. def _get_worker_wrapper_args(self) -> Dict[str, Any]:
  81. if self.speculative_config is not None:
  82. worker_module_name = "aphrodite.spec_decode.spec_decode_worker"
  83. worker_class_name = "create_spec_worker"
  84. else:
  85. worker_module_name = "aphrodite.task_handler.worker"
  86. worker_class_name = "Worker"
  87. return dict(
  88. worker_module_name=worker_module_name,
  89. worker_class_name=worker_class_name,
  90. trust_remote_code=self.model_config.trust_remote_code,
  91. )
  92. def _init_workers_ray(self, placement_group: "PlacementGroup",
  93. **ray_remote_kwargs):
  94. if (self.parallel_config.tensor_parallel_size == 1
  95. and self.parallel_config.pipeline_parallel_size == 1):
  96. # For single GPU case, we use a ray worker with constrained memory.
  97. num_gpus = self.cache_config.gpu_memory_utilization
  98. else:
  99. # Otherwise, the ray workers are allocated with a full GPU.
  100. num_gpus = 1
  101. # The driver dummy worker does not actually use any resources.
  102. # It holds the resource for the driver worker.
  103. self.driver_dummy_worker: Optional[RayWorkerWrapper] = None
  104. # The remaining workers are the actual ray actors.
  105. self.workers: List[RayWorkerWrapper] = []
  106. # Used in ray compiled DAG: indexed first by PP rank,
  107. # and then TP rank. In other words, the inner list is
  108. # the TP group of workers for a PP rank.
  109. self.pp_tp_workers: List[List[RayWorkerWrapper]] = []
  110. if self.parallel_config.ray_workers_use_nsight:
  111. ray_remote_kwargs = self._configure_ray_workers_use_nsight(
  112. ray_remote_kwargs)
  113. logger.info(f"use_ray_spmd_worker: {self.use_ray_spmd_worker}")
  114. # Create the workers.
  115. driver_ip = get_ip()
  116. logger.info(f"driver_ip: {driver_ip}")
  117. worker_wrapper_kwargs = self._get_worker_wrapper_args()
  118. for bundle_id, bundle in enumerate(placement_group.bundle_specs):
  119. if not bundle.get("GPU", 0):
  120. continue
  121. scheduling_strategy = PlacementGroupSchedulingStrategy(
  122. placement_group=placement_group,
  123. placement_group_capture_child_tasks=True,
  124. placement_group_bundle_index=bundle_id,
  125. )
  126. worker = ray.remote(
  127. num_cpus=0,
  128. num_gpus=num_gpus,
  129. scheduling_strategy=scheduling_strategy,
  130. **ray_remote_kwargs,
  131. )(RayWorkerWrapper).remote(**worker_wrapper_kwargs)
  132. if self.use_ray_spmd_worker:
  133. self.workers.append(worker)
  134. else:
  135. worker_ip = ray.get(worker.get_node_ip.remote())
  136. if worker_ip == driver_ip and self.driver_dummy_worker is None:
  137. # If the worker is on the same node as the driver, we use it
  138. # as the resource holder for the driver process.
  139. self.driver_dummy_worker = worker
  140. self.driver_worker = RayWorkerWrapper(
  141. **worker_wrapper_kwargs)
  142. else:
  143. # Else, added to the list of workers.
  144. self.workers.append(worker)
  145. logger.debug(f"workers: {self.workers}")
  146. logger.debug(f"driver_dummy_worker: {self.driver_dummy_worker}")
  147. if not self.use_ray_spmd_worker and self.driver_dummy_worker is None:
  148. raise ValueError(
  149. "Ray does not allocate any GPUs on the driver node. Consider "
  150. "adjusting the Ray placement group or running the driver on a "
  151. "GPU node.")
  152. worker_ips = [
  153. ray.get(worker.get_node_ip.remote()) # type: ignore[attr-defined]
  154. for worker in self.workers
  155. ]
  156. ip_counts: Dict[str, int] = {}
  157. for ip in worker_ips:
  158. ip_counts[ip] = ip_counts.get(ip, 0) + 1
  159. def sort_by_driver_then_worker_ip(worker):
  160. """
  161. Sort the workers based on 3 properties:
  162. 1. If the worker is on the same node as the driver (vllm engine),
  163. it should be placed first.
  164. 2. Then, if the worker is on a node with fewer workers, it should
  165. be placed first.
  166. 3. Finally, if the work is on a node with smaller IP address, it
  167. should be placed first.
  168. """
  169. ip = ray.get(worker.get_node_ip.remote())
  170. return (ip != driver_ip, ip_counts[ip], ip)
  171. # After sorting, the workers on the same node will be
  172. # close to each other, and the workers on the driver
  173. # node will be placed first.
  174. self.workers = sorted(self.workers, key=sort_by_driver_then_worker_ip)
  175. # Get the set of GPU IDs used on each node.
  176. worker_node_and_gpu_ids = self._run_workers("get_node_and_gpu_ids",
  177. use_dummy_driver=True)
  178. node_workers = defaultdict(list) # node id -> list of worker ranks
  179. node_gpus = defaultdict(list) # node id -> list of gpu ids
  180. for i, (node_id, gpu_ids) in enumerate(worker_node_and_gpu_ids):
  181. node_workers[node_id].append(i)
  182. # `gpu_ids` can be a list of strings or integers.
  183. # convert them to integers for consistency.
  184. # NOTE: gpu_ids can be larger than 9 (e.g. 16 GPUs),
  185. # string sorting is not sufficient.
  186. gpu_ids = [int(x) for x in gpu_ids]
  187. node_gpus[node_id].extend(gpu_ids)
  188. for node_id, gpu_ids in node_gpus.items():
  189. node_gpus[node_id] = sorted(gpu_ids)
  190. APHRODITE_INSTANCE_ID = get_aphrodite_instance_id()
  191. # Set environment variables for the driver and workers.
  192. all_args_to_update_environment_variables = [({
  193. "CUDA_VISIBLE_DEVICES":
  194. ",".join(map(str, node_gpus[node_id])),
  195. "APHRODITE_INSTANCE_ID":
  196. APHRODITE_INSTANCE_ID,
  197. "APHRODITE_TRACE_FUNCTION":
  198. str(APHRODITE_TRACE_FUNCTION),
  199. }, ) for (node_id, _) in worker_node_and_gpu_ids]
  200. self._run_workers("update_environment_variables",
  201. all_args=all_args_to_update_environment_variables)
  202. if len(node_gpus) == 1:
  203. # in single node case, we don't need to get the IP address.
  204. # the loopback address is sufficient
  205. # NOTE: a node may have several IP addresses, one for each
  206. # network interface. `get_ip()` might return any of them,
  207. # while they might not work for communication inside the node
  208. # if the network setup is complicated. Using the loopback address
  209. # solves this issue, as it always works for communication inside
  210. # the node.
  211. driver_ip = "127.0.0.1"
  212. distributed_init_method = get_distributed_init_method(
  213. driver_ip, get_open_port())
  214. # Initialize the actual workers inside worker wrapper.
  215. init_worker_all_kwargs = [
  216. self._get_worker_kwargs(
  217. local_rank=node_workers[node_id].index(rank),
  218. rank=rank,
  219. distributed_init_method=distributed_init_method,
  220. ) for rank, (node_id, _) in enumerate(worker_node_and_gpu_ids)
  221. ]
  222. self._run_workers("init_worker", all_kwargs=init_worker_all_kwargs)
  223. self._run_workers("init_device")
  224. self._run_workers("load_model",
  225. max_concurrent_workers=self.parallel_config.
  226. max_parallel_loading_workers)
  227. if self.use_ray_spmd_worker:
  228. for pp_rank in range(self.parallel_config.pipeline_parallel_size):
  229. self.pp_tp_workers.append([])
  230. for tp_rank in range(
  231. self.parallel_config.tensor_parallel_size):
  232. # PP=2, TP=4
  233. # pp_tp_workers = [[0, 1, 2, 3], [4, 5, 6, 7]]
  234. rank = (pp_rank * self.parallel_config.tensor_parallel_size
  235. ) + tp_rank
  236. assert len(self.pp_tp_workers[pp_rank]) == tp_rank
  237. assert pp_rank < len(self.pp_tp_workers)
  238. self.pp_tp_workers[pp_rank].append(self.workers[rank])
  239. # This is the list of workers that are rank 0 of each TP group EXCEPT
  240. # global rank 0. These are the workers that will broadcast to the
  241. # rest of the workers.
  242. self.tp_driver_workers: List[RayWorkerWrapper] = []
  243. # This is the list of workers that are not drivers and not the first
  244. # worker in a TP group. These are the workers that will be
  245. # broadcasted to.
  246. self.non_driver_workers: List[RayWorkerWrapper] = []
  247. # Enforce rank order for correct rank to return final output.
  248. for index, worker in enumerate(self.workers):
  249. # The driver worker is rank 0 and not in self.workers.
  250. rank = index + 1
  251. if rank % self.parallel_config.tensor_parallel_size == 0:
  252. self.tp_driver_workers.append(worker)
  253. else:
  254. self.non_driver_workers.append(worker)
  255. def _driver_execute_model(
  256. self, execute_model_req: Optional[ExecuteModelRequest]
  257. ) -> Optional[List[SamplerOutput]]:
  258. """Run execute_model in the driver worker.
  259. Passing None will cause the driver to stop the model execution
  260. loop running in each of the remote workers.
  261. """
  262. assert not self.use_ray_spmd_worker, (
  263. "driver_worker does not exist for APHRODITE_USE_RAY_SPMD_WORKER=1")
  264. return self.driver_worker.execute_method("execute_model",
  265. execute_model_req)
  266. def execute_model(
  267. self,
  268. execute_model_req: ExecuteModelRequest) -> List[SamplerOutput]:
  269. if not self.use_ray_spmd_worker:
  270. return super().execute_model(execute_model_req)
  271. if self.forward_dag is None:
  272. self.forward_dag = self._compiled_ray_dag(enable_asyncio=False)
  273. outputs = ray.get(self.forward_dag.execute(execute_model_req))
  274. return outputs[0]
  275. def _run_workers(
  276. self,
  277. method: str,
  278. *args,
  279. async_run_tensor_parallel_workers_only: bool = False,
  280. all_args: Optional[List[Tuple[Any, ...]]] = None,
  281. all_kwargs: Optional[List[Dict[str, Any]]] = None,
  282. use_dummy_driver: bool = False,
  283. max_concurrent_workers: Optional[int] = None,
  284. **kwargs,
  285. ) -> Any:
  286. """Runs the given method on all workers. Can be used in the following
  287. ways:
  288. Args:
  289. - async_run_tensor_parallel_workers_only: If True the method will be
  290. run only in the remote TP workers, not the driver worker.
  291. It will also be run asynchronously and return a list of futures
  292. rather than blocking on the results.
  293. - args/kwargs: All workers share the same args/kwargs
  294. - all_args/all_kwargs: args/kwargs for each worker are specified
  295. individually
  296. """
  297. if self.use_ray_spmd_worker:
  298. assert not async_run_tensor_parallel_workers_only, (
  299. "async_run_tensor_parallel_workers_only is not supported for "
  300. "spmd mode.")
  301. if max_concurrent_workers:
  302. raise NotImplementedError(
  303. "max_concurrent_workers is not supported yet.")
  304. count = len(self.workers) if not \
  305. async_run_tensor_parallel_workers_only \
  306. else len(self.non_driver_workers)
  307. # If using SPMD worker, all workers are the same, so we should execute
  308. # the args on all workers. Otherwise, we skip the first worker's args
  309. # because those args will go to the driver worker.
  310. first_worker_args_index: int = 0 if self.use_ray_spmd_worker else 1
  311. all_worker_args = repeat(args, count) if all_args is None \
  312. else islice(all_args, first_worker_args_index, None)
  313. all_worker_kwargs = repeat(kwargs, count) if all_kwargs is None \
  314. else islice(all_kwargs, first_worker_args_index, None)
  315. # Start the ray workers first.
  316. ray_workers = self.workers
  317. if async_run_tensor_parallel_workers_only:
  318. ray_workers = self.non_driver_workers
  319. ray_worker_outputs = [
  320. worker.execute_method.remote(method, *worker_args, **worker_kwargs)
  321. for (worker, worker_args, worker_kwargs
  322. ) in zip(ray_workers, all_worker_args, all_worker_kwargs)
  323. ]
  324. if async_run_tensor_parallel_workers_only:
  325. # Just return futures
  326. return ray_worker_outputs
  327. driver_worker_output = []
  328. # In SPMD mode, the driver worker is the same as any other worker,
  329. # so we only explicitly execute on the driver worker if using a
  330. # non-SPMD worker class.
  331. if not self.use_ray_spmd_worker:
  332. driver_args = args if all_args is None else all_args[0]
  333. driver_kwargs = kwargs if all_kwargs is None else all_kwargs[0]
  334. # Start the driver worker after all the ray workers.
  335. if not use_dummy_driver:
  336. driver_worker_output = [
  337. self.driver_worker.execute_method(method, *driver_args,
  338. **driver_kwargs)
  339. ]
  340. else:
  341. assert self.driver_dummy_worker is not None
  342. driver_worker_output = [
  343. ray.get(
  344. self.driver_dummy_worker.execute_method.remote(
  345. method, *driver_args, **driver_kwargs))
  346. ]
  347. # Get the results of the ray workers.
  348. if self.workers:
  349. ray_worker_outputs = ray.get(ray_worker_outputs)
  350. return driver_worker_output + ray_worker_outputs
  351. def _wait_for_tasks_completion(self, parallel_worker_tasks: Any) -> None:
  352. """Wait for futures returned from _run_workers() with
  353. async_run_remote_workers_only to complete."""
  354. ray.get(parallel_worker_tasks)
  355. def _compiled_ray_dag(self, enable_asyncio: bool):
  356. import pkg_resources
  357. from packaging import version
  358. required_version = version.parse("2.32")
  359. current_version = version.parse(
  360. pkg_resources.get_distribution("ray").version)
  361. if current_version < required_version:
  362. raise ValueError(f"Ray version {required_version} or greater is "
  363. f"required, but found {current_version}")
  364. assert self.parallel_config.use_ray
  365. from ray.dag import InputNode, MultiOutputNode
  366. from ray.experimental.channel.torch_tensor_type import TorchTensorType
  367. logger.info(f"APHRODITE_USE_RAY_COMPILED_DAG_NCCL_CHANNEL = "
  368. f"{APHRODITE_USE_RAY_COMPILED_DAG_NCCL_CHANNEL}")
  369. with InputNode() as input_data:
  370. # Example DAG: PP=2, TP=4
  371. # (ExecuteModelReq, None) -> 0 -> (ExecuteModelReq, IntermediateOutput) -> 4 -> SamplerOutput # noqa: E501
  372. # -> 1 -> (ExecuteModelReq, IntermediateOutput) -> 5 -> SamplerOutput # noqa: E501
  373. # -> 2 -> (ExecuteModelReq, IntermediateOutput) -> 6 -> SamplerOutput # noqa: E501
  374. # -> 3 -> (ExecuteModelReq, IntermediateOutput) -> 7 -> SamplerOutput # noqa: E501
  375. # All workers in the first TP group will take in the
  376. # ExecuteModelRequest as input.
  377. outputs = [input_data for _ in self.pp_tp_workers[0]]
  378. for pp_rank, tp_group in enumerate(self.pp_tp_workers):
  379. # Each PP worker takes in the output of the previous PP worker,
  380. # and the TP group executes in SPMD fashion.
  381. outputs = [
  382. worker.execute_model_spmd.
  383. bind( # type: ignore[attr-defined]
  384. outputs[i]) for i, worker in enumerate(tp_group)
  385. ]
  386. last_pp_rank = len(self.pp_tp_workers) - 1
  387. if pp_rank < last_pp_rank:
  388. # Specify how intermediate tensors should be passed
  389. # between pp stages, no need to specify for the last
  390. # pp stage.
  391. transport = "nccl" \
  392. if APHRODITE_USE_RAY_COMPILED_DAG_NCCL_CHANNEL \
  393. else "auto"
  394. outputs = [
  395. output.with_type_hint(
  396. TorchTensorType(transport=transport))
  397. for output in outputs
  398. ]
  399. forward_dag = MultiOutputNode(outputs)
  400. return forward_dag.experimental_compile(enable_asyncio=enable_asyncio)
  401. def __del__(self):
  402. self.shutdown()
  403. class RayGPUExecutorAsync(RayGPUExecutor, DistributedGPUExecutorAsync):
  404. def __init__(self, *args, **kwargs):
  405. super().__init__(*args, **kwargs)
  406. self.pp_locks: Optional[List[asyncio.Lock]] = None
  407. self.use_ray_spmd_worker = APHRODITE_USE_RAY_SPMD_WORKER
  408. if not self.use_ray_compiled_dag:
  409. self.driver_exec_method = make_async(
  410. self.driver_worker.execute_method)
  411. async def execute_model_async(
  412. self,
  413. execute_model_req: ExecuteModelRequest) -> List[SamplerOutput]:
  414. if not self.use_ray_spmd_worker:
  415. return await super().execute_model_async(execute_model_req)
  416. if self.forward_dag is None:
  417. self.forward_dag = self._compiled_ray_dag(enable_asyncio=True)
  418. dag_future = await self.forward_dag.execute_async(execute_model_req)
  419. outputs = await dag_future
  420. return outputs[0]
  421. async def _driver_execute_model_async(
  422. self,
  423. execute_model_req: Optional[ExecuteModelRequest] = None
  424. ) -> List[SamplerOutput]:
  425. assert not self.use_ray_spmd_worker, (
  426. "driver_worker does not exist for APHRODITE_USE_RAY_SPMD_WORKER=1")
  427. if not self.tp_driver_workers:
  428. return await self.driver_exec_method("execute_model",
  429. execute_model_req)
  430. if self.pp_locks is None:
  431. # This locks each pipeline parallel stage so multiple virtual
  432. # engines can't execute on the same stage at the same time
  433. # We create the locks here to avoid creating them in the constructor
  434. # which uses a different asyncio loop.
  435. self.pp_locks = [
  436. asyncio.Lock()
  437. for _ in range(self.parallel_config.pipeline_parallel_size)
  438. ]
  439. tasks = [
  440. asyncio.create_task(
  441. _run_task_with_lock(self.driver_exec_method, self.pp_locks[0],
  442. "execute_model", execute_model_req))
  443. ]
  444. for pp_rank, driver_worker in enumerate(self.tp_driver_workers,
  445. start=1):
  446. tasks.append(
  447. asyncio.create_task(
  448. _run_task_with_lock(driver_worker.execute_method.remote,
  449. self.pp_locks[pp_rank],
  450. "execute_model", execute_model_req)))
  451. results = await asyncio.gather(*tasks)
  452. # Only the last PP stage has the final results.
  453. return results[-1]
  454. async def _start_worker_execution_loop(self):
  455. assert not self.use_ray_spmd_worker, (
  456. "worker loop is disabled for APHRODITE_USE_RAY_SPMD_WORKER=1")
  457. coros = [
  458. worker.execute_method.remote("start_worker_execution_loop")
  459. for worker in self.non_driver_workers
  460. ]
  461. return await asyncio.gather(*coros)
  462. def __del__(self):
  463. self.shutdown()