File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -206,18 +206,17 @@ async def _run_workers_async(
206206 ** kwargs ,
207207 ) -> Any :
208208 """Runs the given method on all workers."""
209- all_outputs = []
209+ coros = []
210210 for worker in self .workers :
211211 if self .parallel_config .worker_use_ray :
212- executor = partial (worker .execute_method .remote , method )
212+ coros .append (
213+ worker .execute_method .remote (method , * args , ** kwargs ))
213214 else :
214215 executor = getattr (worker , method )
216+ coros .append (asyncio .get_event_loop ().run_in_executor (
217+ None , partial (executor , * args , ** kwargs )))
215218
216- output = executor (* args , ** kwargs )
217- all_outputs .append (output )
218-
219- if self .parallel_config .worker_use_ray :
220- all_outputs = await asyncio .gather (* all_outputs )
219+ all_outputs = await asyncio .gather (* coros )
221220
222221 if get_all_outputs :
223222 return all_outputs
You can’t perform that action at this time.
0 commit comments