code: def test_load_code_from_local(ray_start_regular_shared):
      # This case writes a driver python file to a temporary directory.
      #
      # The driver starts a cluster with
      # `ray.init(ray.job_config.JobConfig(code_search_path=<path list>))`,
      # then creates a nested actor. The actor will be loaded from code in
      # worker.
      #
      # This tests the following two cases when :
      # 1) Load a nested class.
      # 2) Load a class defined in the `__main__` module.
      code_test = """
  import os
  import ray
  
  class A:
      @ray.remote
      class B:
          def get(self):
              return "OK"
  
  if __name__ == "__main__":
      current_path = os.path.dirname(__file__)
      job_config = ray.job_config.JobConfig(code_search_path=[current_path])
      ray.init({}, job_config=job_config)
      b = A.B.remote()
      print(ray.get(b.get.remote()))
  """
  
      # Test code search path contains space.
      with tempfile.TemporaryDirectory(suffix="a b") as tmpdir:
          test_driver = os.path.join(
              tmpdir, "test_load_code_from_local.py"
          )
          with open(test_driver, "w") as f:
              f.write(
                  code_test.format(
                      repr(ray_start_regular_shared["address"])
                  )
              )
          output = subprocess.check_output(
              [sys.executable, test_driver]
          )
          assert b"OK" in output
  
imports: import array
  import logging
  import os
  import random
  import subprocess
  import sys
  import tempfile
  import threading
  import time
  from unittest.mock import MagicMock, patch
  import pytest
  from ray._private.ray_constants import KV_NAMESPACE_FUNCTION_TABLE
  from ray._private.test_utils import client_test_enabled
  from ray.cluster_utils import Cluster, cluster_not_supported
  from ray.exceptions import GetTimeoutError, RayTaskError
  from ray.tests.client_test_utils import create_remote_signal_actor
label_desc: Use image node_id 22 for calling a global function with example usage: test_load_code_from_local(ray_start_regular_shared) without return types