class_docstr: Class containing attributes to pass to input/output class constructors.
  
  RLlib auto-sets these attributes when constructing input/output classes,
  such as InputReaders and OutputWriters.
docstr: Initializes a IOContext object.
  
  Args:
      log_dir: The logging directory to read from/write to.
      config: The (main) AlgorithmConfig object.
      worker_index: When there are multiple workers created, this
          uniquely identifies the current worker. 0 for the local
          worker, >0 for any of the remote workers.
      worker: The RolloutWorker object reference.
docstr_tok: ["Initializes","a","IOContext","object",".","Args",":","log_dir",":","The","logging","directory","to","read","from\/write","to",".","config",":","The","(","main",")","AlgorithmConfig","object",".","worker_index",":","When","there","are","multiple","workers","created",",","this","uniquely","identifies","the","current","worker",".","0","for","the","local","worker",",",">","0","for","any","of","the","remote","workers",".","worker",":","The","RolloutWorker","object","reference","."]
code: def __init__(
      self,
      log_dir: Optional[str] = None,
      config: Optional["AlgorithmConfig"] = None,
      worker_index: int = 0,
      worker: Optional["RolloutWorker"] = None,
  ):
      """Initializes a IOContext object.
  
      Args:
          log_dir: The logging directory to read from/write to.
          config: The (main) AlgorithmConfig object.
          worker_index: When there are multiple workers created, this
              uniquely identifies the current worker. 0 for the local
              worker, >0 for any of the remote workers.
          worker: The RolloutWorker object reference.
      """
      from ray.rllib.algorithms.algorithm_config import AlgorithmConfig
  
      self.log_dir = log_dir or os.getcwd()
      # In case no config is provided, use the default one, but set
      # `actions_in_input_normalized=True` if we don't have a worker.
      # Not having a worker and/or a config should only be the case in some test
      # cases, though.
      self.config = config or AlgorithmConfig().offline_data(
          actions_in_input_normalized=worker is None
      ).training(train_batch_size=1)
      self.worker_index = worker_index
      self.worker = worker
  
file_path: ray/rllib/offline/io_context.py
imports: import os
  from typing import Optional, TYPE_CHECKING
  from ray.rllib.utils.annotations import PublicAPI
label_desc: Use image node_id 1 to create a new IOContext object  with example: obj = IOContext(log_dir, config, worker_index, worker)