code: def ray_start_regular_shared2(request):  # pragma: no cover
      os.environ["RAY_kill_idle_workers_interval_ms"] = "0"
      param = getattr(request, "param", {})
      num_cpus = param.get("num_cpus", 64)
      total_memory_mb = num_cpus * 2 * 1024**2
      try:
          try:
              job_config = ray.job_config.JobConfig(
                  total_memory_mb=total_memory_mb
              )
          except TypeError:
              job_config = None
          yield ray.init(num_cpus=num_cpus, job_config=job_config)
      finally:
          ray.shutdown()
          Router.set_instance(None)
          os.environ.pop("RAY_kill_idle_workers_interval_ms", None)
  
imports: import concurrent.futures
  import os
  import subprocess
  import psutil
  import pytest
  from mars.config import option_context
  from mars.core.mode import is_kernel_mode, is_build_mode
  from mars.lib.aio.lru import clear_all_alru_caches
  from mars.oscar.backends.router import Router
  from mars.oscar.backends.ray.communication import RayServer
  from mars.utils import lazy_import
label_desc: Use image node_id 4 for calling a global function with example usage: ray_start_regular_shared2(request) without return types