class_docstr: Writer object that saves experiences using Datasets.
docstr: Initializes a DatasetWriter instance.
  
  Examples:
  config = {
      "output": "dataset",
      "output_config": {
          "format": "json",
          "path": "/tmp/test_samples/",
          "max_num_samples_per_file": 100000,
      }
  }
  
  Args:
      ioctx: current IO context object.
      compress_columns: list of sample batch columns to compress.
docstr_tok: ["Initializes","a","DatasetWriter","instance",".","Examples",":","config","=","{","``","output","''",":","``","dataset","''",",","``","output_config","''",":","{","``","format","''",":","``","json","''",",","``","path","''",":","``","\/tmp\/test_samples\/","''",",","``","max_num_samples_per_file","''",":","100000",",","}","}","Args",":","ioctx",":","current","IO","context","object",".","compress_columns",":","list","of","sample","batch","columns","to","compress","."]
code: def __init__(
      self,
      ioctx: IOContext = None,
      compress_columns: List[str] = frozenset(["obs", "new_obs"]),
  ):
      """Initializes a DatasetWriter instance.
  
      Examples:
      config = {
          "output": "dataset",
          "output_config": {
              "format": "json",
              "path": "/tmp/test_samples/",
              "max_num_samples_per_file": 100000,
          }
      }
  
      Args:
          ioctx: current IO context object.
          compress_columns: list of sample batch columns to compress.
      """
      self.ioctx = ioctx or IOContext()
  
      output_config: Dict = ioctx.output_config
      assert (
          "format" in output_config
      ), "output_config.format must be specified when using Dataset output."
      assert (
          "path" in output_config
      ), "output_config.path must be specified when using Dataset output."
  
      self.format = output_config["format"]
      self.path = os.path.abspath(
          os.path.expanduser(output_config["path"])
      )
      self.max_num_samples_per_file = (
          output_config["max_num_samples_per_file"]
          if "max_num_samples_per_file" in output_config
          else 100000
      )
      self.compress_columns = compress_columns
  
      self.samples = []
  
file_path: ray/python/ray/rllib/offline/dataset_writer.py
imports: import logging
  import os
  import time
  from ray import data
  from ray.rllib.offline.io_context import IOContext
  from ray.rllib.offline.json_writer import _to_json_dict
  from ray.rllib.offline.output_writer import OutputWriter
  from ray.rllib.utils.annotations import override, PublicAPI
  from ray.rllib.utils.typing import SampleBatchType
  from typing import Dict, List
label_desc: Use image node_id 1 to create a new DatasetWriter object from inherited base classes: OutputWriter with example: obj = DatasetWriter(ioctx, compress_columns)