code: def test_http_head_only(ray_cluster):
      cluster = ray_cluster
      head_node = cluster.add_node(num_cpus=4)
      cluster.add_node(num_cpus=4)
  
      ray.init(head_node.address)
      node_ids = ray._private.state.node_ids()
      assert len(node_ids) == 2
  
      serve.start(
          http_options={"port": new_port(), "location": "HeadOnly"}
      )
  
      # Only the controller and head node actor should be started
      assert len(ray._private.state.actors()) == 2
  
      # They should all be placed on the head node
      cpu_per_nodes = {
          r["CPU"]
          for r in ray._private.state.state._available_resources_per_node().values()
      }
      assert cpu_per_nodes == {4, 4}
  
imports: import logging
  import os
  import socket
  import sys
  import time
  import pytest
  import requests
  import ray
  import ray._private.gcs_utils
  from ray import serve
  from ray._private.services import new_port
  from ray._private.test_utils import convert_actor_state, run_string_as_driver, wait_for_condition
  from ray._raylet import GcsClient
  from ray.cluster_utils import Cluster, cluster_not_supported
  from ray.serve._private import api
  from ray.serve._private.constants import SERVE_CONTROLLER_NAME, SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE, SERVE_PROXY_NAME, SERVE_ROOT_URL_ENV_KEY
  from ray.serve._private.default_impl import create_cluster_node_info_cache
  from ray.serve._private.http_util import set_socket_reuse_port
  from ray.serve._private.utils import block_until_http_ready, format_actor_name
  from ray.serve.config import DeploymentMode, HTTPOptions, ProxyLocation
  from ray.serve.context import _get_global_client
  from ray.serve.exceptions import RayServeException
  from ray.serve.schema import ServeApplicationSchema, ServeDeploySchema
  from ray.tests.conftest import maybe_external_redis
  from ray.tests.conftest import ray_start_with_dashboard
  from ray.util.state import list_actors
label_desc: Use image node_id 16 for calling a global function with example usage: test_http_head_only(ray_cluster) without return types