code: def export_setup_func_callable(
      runtime_env: Union[Dict[str, Any], RuntimeEnv],
      setup_func: Callable,
      worker: "ray.Worker",
  ) -> Union[Dict[str, Any], RuntimeEnv]:
      assert isinstance(setup_func, Callable)
      try:
          key = worker.function_actor_manager.export_setup_func(
              setup_func, timeout=get_import_export_timeout()
          )
      except Exception as e:
          raise ray.exceptions.RuntimeEnvSetupError(
              "Failed to export the setup function."
          ) from e
      env_vars = runtime_env.get("env_vars", {})
      assert (
          ray_constants.WORKER_PROCESS_SETUP_HOOK_ENV_VAR
          not in env_vars
      ), (
          f"The env var, {ray_constants.WORKER_PROCESS_SETUP_HOOK_ENV_VAR}, "
          "is not permitted because it is reserved for the internal use."
      )
      env_vars[
          ray_constants.WORKER_PROCESS_SETUP_HOOK_ENV_VAR
      ] = _decode_function_key(key)
      runtime_env["env_vars"] = env_vars
      # Note: This field is no-op. We don't have a plugin for the setup hook
      # because we can implement it simply using an env var.
      # This field is just for the observability purpose, so we store
      # the name of the method.
      runtime_env["worker_process_setup_hook"] = setup_func.__name__
      return runtime_env
  
file_path: ray/python/ray/_private/runtime_env/setup_hook.py
imports: import traceback
  import logging
  import base64
  import os
  from typing import Dict, Any, Callable, Union, Optional
  import ray
  import ray._private.ray_constants
  from ray._private.storage import _load_class
  import ray.cloudpickle
  from ray.runtime_env import RuntimeEnv
label_desc: Use image node_id 4 for calling a global function with example usage: export_setup_func_callable(runtime_env, setup_func, worker) and returns: runtime_env