code: def test_node_id_resource(ray_start_cluster):
      cluster = ray_start_cluster
      cluster.add_node(num_cpus=3)
      cluster.add_node(num_cpus=3)
      ray.init(address=cluster.address)
  
      local_node = ray._private.state.current_node_id()
  
      # Note that these will have the same IP in the test cluster
      assert len(ray._private.state.node_ids()) == 2
      assert local_node in ray._private.state.node_ids()
  
      @ray.remote(resources={local_node: 1})
      def f():
          return ray._private.state.current_node_id()
  
      # Check the node id resource is automatically usable for scheduling.
      assert ray.get(f.remote()) == ray._private.state.current_node_id()
  
imports: import logging
  import os
  import sys
  import time
  import numpy
  import pytest
  import ray
  import ray.cluster_utils
  from ray._private.test_utils import RayTestTimeoutException, wait_for_condition
  from ray.util.placement_group import placement_group
  from ray.util.accelerators import AWS_NEURON_CORE
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
label_desc: Use image node_id 8 for calling a global function with example usage: test_node_id_resource(ray_start_cluster) and returns: ray