code: def ray_start_2_cpus():
      is_ray_initialized = ray.is_initialized()
      with tempfile.TemporaryDirectory() as tmpdir:
          if not is_ray_initialized:
              res = ray.init(
                  num_cpus=2,
                  include_dashboard=False,
                  object_store_memory=150 * 1024 * 1024,
                  _temp_dir=tmpdir,
              )
          else:
              res = None
          try:
              yield res
          finally:
              if not is_ray_initialized:
                  ray.shutdown()
  
file_path: ray/python/ray/tests/ludwig/test_ludwig.py
imports: import contextlib
  import os
  import tempfile
  import pytest
  import ray
label_desc: Use image node_id 1 for calling a global function with example usage: ray_start_2_cpus() without return types