class_docstr: An example implementation of a writable datasource for testing.
  
  Examples:
      >>> import ray
      >>> from ray.data.datasource import DummyOutputDatasource
      >>> output = DummyOutputDatasource() # doctest: +SKIP
      >>> ray.data.range(10).write_datasource(output) # doctest: +SKIP
      >>> assert output.num_ok == 1 # doctest: +SKIP
class_docstr_tok: ["An","example","implementation","of","a","writable","datasource","for","testing",".","Examples",":",">",">",">","import","ray",">",">",">","from","ray.data.datasource","import","DummyOutputDatasource",">",">",">","output","=","DummyOutputDatasource","(",")","#","doctest",":","+SKIP",">",">",">","ray.data.range","(","10",")",".write_datasource","(","output",")","#","doctest",":","+SKIP",">",">",">","assert","output.num_ok","==","1","#","doctest",":","+SKIP"]
code: def __init__(self):
      ctx = DataContext.get_current()
  
      # Setup a dummy actor to send the data. In a real datasource, write
      # tasks would send data to an external system instead of a Ray actor.
      @ray.remote(scheduling_strategy=ctx.scheduling_strategy)
      class DataSink:
          def __init__(self):
              self.rows_written = 0
              self.enabled = True
  
          def write(self, block: Block) -> str:
              block = BlockAccessor.for_block(block)
              self.rows_written += block.num_rows()
              return "ok"
  
          def get_rows_written(self):
              return self.rows_written
  
      self.data_sink = DataSink.remote()
      self.num_ok = 0
      self.num_failed = 0
      self.enabled = True
  
imports: import warnings
  from typing import Any, Callable, Iterable, List, Optional
  import numpy
  import ray
  from ray.data._internal.execution.interfaces import TaskContext
  from ray.data._internal.util import _check_pyarrow_version
  from ray.data.block import Block, BlockAccessor, BlockMetadata
  from ray.data.context import DataContext
  from ray.types import ObjectRef
  from ray.util.annotations import Deprecated, DeveloperAPI, PublicAPI
label_desc: Use image node_id 1 to create a new DummyOutputDatasource object from inherited base classes: Datasource with example: obj = DummyOutputDatasource()