ray.rllib.evaluation.worker_set.WorkerSet.foreach_worker_async
ray.rllib.evaluation.worker_set.WorkerSet.foreach_worker_async#
- WorkerSet.foreach_worker_async(func: Callable[[ray.rllib.evaluation.rollout_worker.RolloutWorker], ray.rllib.evaluation.worker_set.T], *, healthy_only=False, remote_worker_ids: Optional[List[int]] = None) int [source]#
Calls the given function asynchronously with each worker as the argument.
foreach_worker_async() does not return results directly. Instead, fetch_ready_async_reqs() can be used to pull results in an async manner whenever they are available.
- Parameters
func – The function to call for each worker (as only arg).
healthy_only – Apply func on known active workers only. By default this will apply func on all workers regardless of their states.
remote_worker_ids – Apply func on a selected set of remote workers.
- Returns
The number of async requests that are currently in-flight.