code: def test_fake_batching_autoscaler_e2e(shutdown_only):
      cluster = BatchingAutoscalingCluster(
          head_resources={"CPU": 2},
          worker_node_types={
              "cpu_node": {
                  "resources": {
                      "CPU": 4,
                      "object_store_memory": 1024 * 1024 * 1024,
                  },
                  "node_config": {},
                  "min_workers": 0,
                  "max_workers": 2,
              },
              "gpu_node": {
                  "resources": {
                      "CPU": 2,
                      "GPU": 1,
                      "object_store_memory": 1024 * 1024 * 1024,
                  },
                  "node_config": {},
                  "min_workers": 0,
                  "max_workers": 2,
              },
          },
      )
  
      try:
          cluster.start()
          ray.init("auto")
  
          # Triggers the addition of a GPU node.
          @ray.remote(num_gpus=1)
          def f():
              print("gpu ok")
  
          # Triggers the addition of a CPU node.
          @ray.remote(num_cpus=3)
          def g():
              print("cpu ok")
  
          ray.get(f.remote())
          ray.get(g.remote())
          # Wait for scale-down.
          wait_for_condition(
              lambda: ray.cluster_resources().get("CPU", 0) == 2,
              timeout=30,
          )
          ray.shutdown()
      finally:
          cluster.shutdown()
  
imports: from copy import deepcopy
  import sys
  import pytest
  import ray
  from ray._private.test_utils import wait_for_condition
  from ray.autoscaler.batching_node_provider import BatchingNodeProvider, NodeData, ScaleRequest
  from ray.autoscaler._private.fake_multi_node.node_provider import FakeMultiNodeProvider
  from ray.autoscaler._private.constants import FOREGROUND_NODE_LAUNCH_KEY
  from ray.autoscaler.tags import NODE_KIND_WORKER, STATUS_UP_TO_DATE, TAG_RAY_NODE_KIND, TAG_RAY_NODE_STATUS, TAG_RAY_USER_NODE_TYPE
  from ray.cluster_utils import AutoscalingCluster
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: test_fake_batching_autoscaler_e2e(shutdown_only) without return types