code: def test_resource_parallelism_single(
      ray_start_4_cpus_2_gpus_extra, resource_manager_cls, bundles
  ):
      """Test that extra and custom resources are respected for parallelism.
  
      We schedule two trials with resources according to the bundle. If only
      the head bundle or only CPU/GPU resources were considered, both trials
      could run in parallel.
  
      However, we assert that the resources in child bundles and extra resources
      are respected and only one trial runs in parallel.
  
      Legacy test: test_trial_runner.py::TrialRunnerTest::testExtraResources
      Legacy test: test_trial_runner.py::TrialRunnerTest::testCustomResources
      Legacy test: test_trial_runner.py::TrialRunnerTest::testExtraCustomResources
      Legacy test: test_trial_runner.py::TrialRunnerTest::testResourceScheduler
      """
      snapshot = TrialStatusSnapshot()
      runner = TuneController(
          resource_manager_factory=lambda: resource_manager_cls(),
          callbacks=[TrialStatusSnapshotTaker(snapshot)],
          storage=STORAGE,
      )
      kwargs = {
          "stopping_criterion": {"training_iteration": 1},
          "placement_group_factory": PlacementGroupFactory(bundles),
          "storage": STORAGE,
      }
      trials = [Trial("__fake", **kwargs), Trial("__fake", **kwargs)]
      for t in trials:
          runner.add_trial(t)
  
      while not runner.is_finished():
          runner.step()
  
      assert snapshot.max_running_trials() == 1
      assert snapshot.all_trials_are_terminated()
  
imports: import os
  import time
  from collections import Counter
  import pytest
  import sys
  import ray
  from ray import tune
  from ray.air.execution import FixedResourceManager, PlacementGroupResourceManager
  from ray.tune import PlacementGroupFactory, TuneError
  from ray.tune.execution.tune_controller import TuneController
  from ray.tune.experiment import Trial
  from ray.tune.schedulers import FIFOScheduler, TrialScheduler
  from ray.tune.search import BasicVariantGenerator
  from ray.tune.utils.mock import TrialStatusSnapshot, TrialStatusSnapshotTaker
  from ray.train.tests.util import mock_storage_context
label_desc: Use image node_id 2 for calling a global function with example usage: test_resource_parallelism_single(ray_start_4_cpus_2_gpus_extra, resource_manager_cls, bundles) without return types