code: def test_context_placement_group():
      driver_code = """
  import ray
  from ray.data.context import DataContext
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
  from ray._private.test_utils import placement_group_assert_no_leak
  
  ray.init(num_cpus=1)
  
  context = DataContext.get_current()
  # This placement group will take up all cores of the local cluster.
  placement_group = ray.util.placement_group(
      name="core_hog",
      strategy="SPREAD",
      bundles=[
          {"CPU": 1},
      ],
  )
  ray.get(placement_group.ready())
  context.scheduling_strategy = PlacementGroupSchedulingStrategy(placement_group)
  ds = ray.data.range(100, parallelism=2).map(lambda x: {"id": x["id"] + 1})
  assert ds.take_all() == [{"id": x} for x in range(1, 101)]
  placement_group_assert_no_leak([placement_group])
  ray.shutdown()
      """
  
      # Successful exit is sufficient to verify this test.
      run_string_as_driver(driver_code)
  
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 8 for calling a global function with example usage: test_context_placement_group() without return types