ray.rllib.evaluation.worker_set.WorkerSet.foreach_worker_async#

WorkerSet.foreach_worker_async(func: Callable[[EnvRunner], T], *, healthy_only: bool = False, remote_worker_ids: 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-to-be healthy workers only.

  • remote_worker_ids – Apply func on a selected set of remote workers.

Returns:

The number of async requests that are currently in-flight.