code: def test_node_label_scheduling_with_soft(ray_start_cluster):
      cluster = ray_start_cluster
      cluster.add_node(
          resources={"worker1": 1},
          num_cpus=3,
          labels={"gpu_type": "A100", "azone": "azone-1"},
      )
      cluster.wait_for_nodes()
      ray.init(address=cluster.address)
      node_1 = ray.get(
          get_node_id.options(resources={"worker1": 1}).remote()
      )
      cluster.add_node(
          resources={"worker2": 1},
          num_cpus=3,
          labels={"gpu_type": "T100", "azone": "azone-1"},
      )
      node_2 = ray.get(
          get_node_id.options(resources={"worker2": 1}).remote()
      )
      cluster.add_node(
          resources={"worker3": 1},
          num_cpus=3,
          labels={"gpu_type": "T100", "azone": "azone-2"},
      )
      node_3 = ray.get(
          get_node_id.options(resources={"worker3": 1}).remote()
      )
      cluster.add_node(resources={"worker4": 1}, num_cpus=3)
      node_4 = ray.get(
          get_node_id.options(resources={"worker4": 1}).remote()
      )
      cluster.wait_for_nodes()
  
      # hard match and soft match
      actor = MyActor.options(
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={"azone": In("azone-1")},
              soft={"gpu_type": In("T100")},
          )
      ).remote()
      assert ray.get(actor.get_node_id.remote(), timeout=3) == node_2
  
      # hard match and soft don't match
      actor = MyActor.options(
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={"azone": In("azone-1")},
              soft={"gpu_type": In("H100")},
          )
      ).remote()
      assert ray.get(actor.get_node_id.remote(), timeout=3) in (
          node_1,
          node_2,
      )
  
      # no hard and  soft match
      actor = MyActor.options(
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={}, soft={"gpu_type": Exists()}
          )
      ).remote()
      assert ray.get(actor.get_node_id.remote(), timeout=3) in (
          node_1,
          node_2,
          node_3,
      )
  
      # no hard and soft don't match
      actor = MyActor.options(
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={}, soft={"gpu_type": In("H100")}
          )
      ).remote()
      assert ray.get(actor.get_node_id.remote(), timeout=3) in (
          node_1,
          node_2,
          node_3,
          node_4,
      )
  
      # hard don't match and soft match
      actor = MyActor.options(
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={"azone": In("azone-3")},
              soft={"gpu_type": In("T100")},
          )
      ).remote()
      with pytest.raises(TimeoutError):
          ray.get(actor.get_node_id.remote(), timeout=3)
  
file_path: ray/python/ray/tests/test_node_label_scheduling_strategy.py
imports: import os
  import sys
  import pytest
  import ray
  from ray.util.scheduling_strategies import In, NotIn, Exists, DoesNotExist, NodeLabelSchedulingStrategy
label_desc: Use image node_id 4 for calling a global function with example usage: test_node_label_scheduling_with_soft(ray_start_cluster) without return types