code: def test_fork_support(shutdown_only):
      """Test that fork support works."""
      ray.init(
          _system_config={
              "support_fork": True,
          },
      )
  
      @ray.remote
      def pool_factorial():
          import math
          import multiprocessing
  
          ctx = multiprocessing.get_context("fork")
          with ctx.Pool(processes=4) as pool:
              return sum(pool.map(math.factorial, range(8)))
  
      @ray.remote
      def g():
          import threading
  
          assert threading.get_ident() == threading.main_thread().ident
          # Make sure this is the only Python thread, because forking does not
          # work well under multi-threading.
          assert threading.active_count() == 1
  
          return ray.get(pool_factorial.remote())
  
      assert ray.get(g.remote()) == 5914
  
imports: import logging
  import subprocess
  import sys
  import time
  from pathlib import Path
  import os
  import pytest
  from unittest import mock
  import ray
  import ray.cluster_utils
  from ray._private.test_utils import wait_for_condition
  from ray.autoscaler._private.constants import RAY_PROCESSES
  import psutil
label_desc: Use image node_id 4 for calling a global function with example usage: test_fork_support(shutdown_only) and returns: ray, sum