code: def test_ray_start_non_head(call_ray_stop_only, monkeypatch):
      # Test that we can call ray start to connect to an existing cluster.
  
      # Test starting Ray with a port specified.
      check_call_ray(
          [
              "start",
              "--head",
              "--port",
              "7298",
              "--resources",
              '{"res_0": 1}',
          ]
      )
  
      # Test starting node connecting to the above cluster.
      check_call_ray(
          [
              "start",
              "--address",
              "127.0.0.1:7298",
              "--resources",
              '{"res_1": 1}',
          ]
      )
  
      # Test starting Ray with address `auto`.
      check_call_ray(
          ["start", "--address", "auto", "--resources", '{"res_2": 1}']
      )
  
      # Run tasks to verify nodes with custom resources are available.
      driver_script = """
  import ray
  ray.init()
  
  @ray.remote
  def f():
      return 1
  
  assert ray.get(f.remote()) == 1
  assert ray.get(f.options(resources={"res_0": 1}).remote()) == 1
  assert ray.get(f.options(resources={"res_1": 1}).remote()) == 1
  assert ray.get(f.options(resources={"res_2": 1}).remote()) == 1
  print("success")
  """
      monkeypatch.setenv("RAY_ADDRESS", "auto")
      out = run_string_as_driver(driver_script)
      # Make sure the driver succeeded.
      assert "success" in out
  
      check_call_ray(["stop"])
  
imports: import asyncio
  import os
  import subprocess
  import sys
  from pathlib import Path
  import psutil
  import pytest
  import ray
  import ray._private.ray_constants
  from ray._private.test_utils import Semaphore, check_call_ray, check_call_subprocess, kill_process_by_name, start_redis_instance, run_string_as_driver, run_string_as_driver_nonblocking, wait_for_children_of_pid, wait_for_children_of_pid_to_exit
  from ray._private.utils import detect_fate_sharing_support
label_desc: Use image node_id 2 for calling a global function with example usage: test_ray_start_non_head(call_ray_stop_only, monkeypatch) without return types