- WorkerSet.foreach_worker(func: Callable[[EnvRunner], T], *, local_worker: bool = True, healthy_only: bool = False, remote_worker_ids: List[int] = None, timeout_seconds: int | None = None, return_obj_refs: bool = False, mark_healthy: bool = False) List[T] #
Calls the given function with each worker instance as the argument.
func – The function to call for each worker (as only arg).
local_worker – Whether apply
funcon local worker too. Default is True.
healthy_only – Apply
funcon known-to-be healthy workers only.
remote_worker_ids – Apply
funcon a selected set of remote workers.
timeout_seconds – Time to wait for results. Default is None.
return_obj_refs – whether to return ObjectRef instead of actual results. Note, for fault tolerance reasons, these returned ObjectRefs should never be resolved with ray.get() outside of this WorkerSet.
mark_healthy – Whether to mark the worker as healthy based on call results.
The list of return values of all calls to