code: def test_namespace_in_job_config(shutdown_only):
      # JobConfig isn't a public API, but we'll set it directly, instead of
      # using the param in code paths like the ray client.
      job_config = ray.job_config.JobConfig(ray_namespace="namespace")
      info = ray.init(job_config=job_config)
  
      address = info["address"]
  
      # First param of template is the namespace. Second is the redis address.
      driver_template = """
  import ray
  
  ray.init(address="{}", namespace="namespace")
  
  @ray.remote
  class DetachedActor:
      def ping(self):
          return "pong from other job"
  
  actor = DetachedActor.options(name="Pinger", lifetime="detached").remote()
  ray.get(actor.ping.remote())
      """
  
      run_string_as_driver(driver_template.format(address))
  
      act = ray.get_actor("Pinger")
      assert ray.get(act.ping.remote()) == "pong from other job"
  
file_path: ray/python/ray/tests/test_namespace.py
imports: import sys
  import time
  import pytest
  import ray
  from ray._private import ray_constants
  from ray._private.test_utils import get_error_message, init_error_pubsub, run_string_as_driver
  from ray.cluster_utils import Cluster
label_desc: Use image node_id 4 for calling a global function with example usage: test_namespace_in_job_config(shutdown_only) without return types