code: def create_or_update_cluster(
      cluster_config: Union[dict, str],
      *,
      no_restart: bool = False,
      restart_only: bool = False,
      no_config_cache: bool = False,
  ) -> Dict[str, Any]:
      """Create or updates an autoscaling Ray cluster from a config json.
  
      Args:
          cluster_config (Union[str, dict]): Either the config dict of the
              cluster, or a path pointing to a file containing the config.
          no_restart: Whether to skip restarting Ray services during the
              update. This avoids interrupting running jobs and can be used to
              dynamically adjust autoscaler configuration.
          restart_only: Whether to skip running setup commands and only
              restart Ray. This cannot be used with 'no-restart'.
          no_config_cache: Whether to disable the config cache and fully
              resolve all environment settings from the Cloud provider again.
      """
      with _as_config_file(cluster_config) as config_file:
          return commands.create_or_update_cluster(
              config_file=config_file,
              override_min_workers=None,
              override_max_workers=None,
              no_restart=no_restart,
              restart_only=restart_only,
              yes=True,
              override_cluster_name=None,
              no_config_cache=no_config_cache,
              redirect_command_output=None,
              use_login_shells=True,
          )
  
imports: import json
  import os
  import tempfile
  from contextlib import contextmanager
  from typing import Any, Callable, Dict, Iterator, List, Optional, Union
  from ray.autoscaler._private import commands
  from ray.autoscaler._private.cli_logger import cli_logger
  from ray.autoscaler._private.event_system import CreateClusterEvent
  from ray.autoscaler._private.event_system import global_event_system
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 1 for calling a global function with example usage: create_or_update_cluster(cluster_config) and returns: commands