ray.rllib.env.env_runner_group.EnvRunnerGroup.foreach_worker_with_id#
- EnvRunnerGroup.foreach_worker_with_id(func: Callable[[int, EnvRunner], T], *, local_env_runner: bool = True, healthy_only: bool = True, remote_worker_ids: List[int] = None, timeout_seconds: float | None = None, local_worker=-1) List[T] [source]#
Calls the given function with each EnvRunner and its ID as its arguments.
- Parameters:
func – The function to call for each worker (as only arg).
local_env_runner – Whether to apply
func
tn local worker, too. Default is True.healthy_only – Apply
func
on known-to-be healthy workers only.remote_worker_ids – Apply
func
on a selected set of remote workers.timeout_seconds – Time to wait for results. Default is None.
- Returns:
The list of return values of all calls to
func([worker, id])
.
DeveloperAPI: This API may change across minor Ray releases.