ray.rllib.evaluation.rollout_worker.RolloutWorker.__init__#

RolloutWorker.__init__(*, env_creator: Callable[[EnvContext], Optional[Any]], validate_env: Optional[Callable[[Any, ray.rllib.env.env_context.EnvContext], None]] = None, config: Optional[AlgorithmConfig] = None, worker_index: int = 0, num_workers: Optional[int] = None, recreated_worker: bool = False, log_dir: Optional[str] = None, spaces: Optional[Dict[str, Tuple[<MagicMock name='mock.Space' id='140492834250560'>, <MagicMock name='mock.Space' id='140492834250560'>]]] = None, default_policy_class: Optional[Type[ray.rllib.policy.policy.Policy]] = None, dataset_shards: Optional[List[ray.data.dataset.Dataset]] = None, tf_session_creator=-1)[source]#

Initializes a RolloutWorker instance.

Parameters
  • env_creator – Function that returns a gym.Env given an EnvContext wrapped configuration.

  • validate_env – Optional callable to validate the generated environment (only on worker=0).

  • worker_index – For remote workers, this should be set to a non-zero and unique value. This index is passed to created envs through EnvContext so that envs can be configured per worker.

  • recreated_worker – Whether this worker is a recreated one. Workers are recreated by an Algorithm (via WorkerSet) in case recreate_failed_workers=True and one of the original workers (or an already recreated one) has failed. They don’t differ from original workers other than the value of this flag (self.recreated_worker).

  • log_dir – Directory where logs can be placed.

  • spaces – An optional space dict mapping policy IDs to (obs_space, action_space)-tuples. This is used in case no Env is created on this RolloutWorker.