code: def _ray_start_regular(request):  # pragma: no cover
      param = getattr(request, "param", {})
      if not param.get("enable", True):
          yield
      elif ray and ray.is_initialized():
          yield
      else:
          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)
              RayServer.clear()
              if "COV_CORE_SOURCE" in os.environ:
                  # Remove this when https://github.com/ray-project/ray/issues/16802 got fixed
                  subprocess.check_call(["ray", "stop", "--force"])
  
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 6 for calling a global function with example usage: _ray_start_regular(request) without return types