code: def client_mode_wrap(func):
      """Wraps a function called during client mode for execution as a remote
      task.
  
      Can be used to implement public features of ray client which do not
      belong in the main ray API (`ray.*`), yet require server-side execution.
      An example is the creation of placement groups:
      `ray.util.placement_group.placement_group()`. When called on the client
      side, this function is wrapped in a task to facilitate interaction with
      the GCS.
      """
  
      @wraps(func)
      def wrapper(*args, **kwargs):
          from ray.util.client import ray
  
          auto_init_ray()
          # Directly pass this through since `client_mode_wrap` is for
          # Placement Group APIs
          if client_mode_should_convert():
              f = ray.remote(num_cpus=0)(func)
              ref = f.remote(*args, **kwargs)
              return ray.get(ref)
          return func(*args, **kwargs)
  
      return wrapper
  
file_path: ray/python/ray/_private/client_mode_hook.py
imports: import os
  import threading
  from contextlib import contextmanager
  from functools import wraps
  from ray._private.auto_init_hook import auto_init_ray
label_desc: Use image node_id 10 for calling a global function with example usage: client_mode_wrap(func) and returns: wrapper, func, ray