code: def test_read(
      ray_start_regular_shared,
      restore_data_context,
  ):
      class CustomDatasource(Datasource):
          def prepare_read(self, parallelism: int):
              value = DataContext.get_current().foo
              meta = BlockMetadata(
                  num_rows=1,
                  size_bytes=8,
                  schema=None,
                  input_files=None,
                  exec_stats=None,
              )
              return [
                  ReadTask(
                      lambda: [pd.DataFrame({"id": [value]})], meta
                  )
              ]
  
      context = DataContext.get_current()
      context.foo = 12345
      assert (
          ray.data.read_datasource(CustomDatasource()).take_all()[0][
              "id"
          ]
          == 12345
      )
  
file_path: ray/python/ray/data/tests/test_context_propagation.py
imports: import pandas
  import pytest
  import ray
  from ray._private.test_utils import run_string_as_driver
  from ray.data.block import BlockMetadata
  from ray.data.context import DataContext
  from ray.data.datasource import Datasource, ReadTask
  from ray.tests.conftest import *
label_desc: Use image node_id 2 for calling a global function with example usage: test_read(ray_start_regular_shared, restore_data_context) and returns: list