code: def test_node_not_available(ray_start_cluster):
      cluster = ray_start_cluster
      cluster.add_node(
          resources={"worker1": 1},
          num_cpus=1,
          labels={"gpu_type": "A100"},
      )
      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=1)
      node_2 = ray.get(
          get_node_id.options(resources={"worker2": 1}).remote()
      )
      cluster.wait_for_nodes()
  
      # Infeasible
      actor = MyActor.options(
          num_cpus=2,
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={"gpu_type": In("A100")}
          ),
      ).remote()
      with pytest.raises(TimeoutError):
          ray.get(actor.get_node_id.remote(), timeout=3)
  
      actor = MyActor.options(
          num_cpus=1,
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={"gpu_type": In("A100")}
          ),
      ).remote()
      assert ray.get(actor.get_node_id.remote(), timeout=3) == node_1
  
      # Soft match node is not available, sheduling to other available node.
      actor_2 = MyActor.options(
          num_cpus=1,
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={}, soft={"gpu_type": In("A100")}
          ),
      ).remote()
      assert ray.get(actor_2.get_node_id.remote(), timeout=3) == node_2
  
      # No available nodes.
      actor_3 = MyActor.options(
          num_cpus=1,
          scheduling_strategy=NodeLabelSchedulingStrategy(
              hard={}, soft={"gpu_type": In("A100")}
          ),
      ).remote()
      with pytest.raises(TimeoutError):
          ray.get(actor_3.get_node_id.remote(), timeout=3)
  
      # node_1 change to available
      ray.kill(actor)
      assert ray.get(actor_3.get_node_id.remote(), timeout=3) == node_1
  
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 5 for calling a global function with example usage: test_node_not_available(ray_start_cluster) without return types