code: def test_gpu_scheduling_liveness(ray_start_cluster):
      """Check if the GPU scheduling is in progress when
      it is used with the placement group
      Issue: https://github.com/ray-project/ray/issues/19130
      """
      cluster = ray_start_cluster
      # Start a node without a gpu.
      cluster.add_node(num_cpus=6)
      ray.init(address=cluster.address)
  
      NUM_CPU_BUNDLES = 10
  
      @ray.remote(num_cpus=1)
      class Worker(object):
          def __init__(self, i):
              self.i = i
  
          def work(self):
              time.sleep(0.1)
              print("work ", self.i)
  
      @ray.remote(num_cpus=1, num_gpus=1)
      class Trainer(object):
          def __init__(self, i):
              self.i = i
  
          def train(self):
              time.sleep(0.2)
              print("train ", self.i)
  
      bundles = [{"CPU": 1, "GPU": 1}]
      bundles += [{"CPU": 1} for _ in range(NUM_CPU_BUNDLES)]
  
      pg = ray.util.placement_group(bundles, strategy="PACK")
      o = pg.ready()
      # Artificial delay to simulate the real world workload.
      time.sleep(3)
      print("Scaling up.")
      cluster.add_node(num_cpus=6, num_gpus=1)
      ray.get(o)
  
      workers = [
          Worker.options(
              scheduling_strategy=PlacementGroupSchedulingStrategy(
                  placement_group=pg
              )
          ).remote(i)
          for i in range(NUM_CPU_BUNDLES)
      ]
      trainer = Trainer.options(
          scheduling_strategy=PlacementGroupSchedulingStrategy(
              placement_group=pg
          )
      ).remote(0)
  
      # If the gpu scheduling doesn't properly work, the below
      # code will hang.
      ray.get(
          [workers[i].work.remote() for i in range(NUM_CPU_BUNDLES)],
          timeout=30,
      )
      ray.get(trainer.train.remote(), timeout=30)
  
imports: import collections
  import logging
  import platform
  import subprocess
  import sys
  import time
  import unittest
  import numpy
  import pytest
  import ray
  import ray.cluster_utils
  import ray.util.accelerators
  from ray._private.internal_api import memory_summary
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
  from ray._private.test_utils import Semaphore, SignalActor, object_memory_usage, get_metric_check_condition, wait_for_condition, MetricSamplePattern
label_desc: Use image node_id 18 for calling a global function with example usage: test_gpu_scheduling_liveness(ray_start_cluster) without return types