class_docstr: Interface to run commands on a remote cluster node.
  
  **Important**: This is an INTERNAL API that is only exposed for the purpose
  of implementing custom node providers. It is not allowed to call into
  CommandRunner methods from any Ray package outside the autoscaler, only to
  define new implementations for use with the "external" node provider
  option.
  
  Command runner instances are returned by provider.get_command_runner().
docstr: Run the given command on the cluster node and optionally get output.
  
  WARNING: the cloudgateway needs arguments of "run" function to be json
      dumpable to send them over HTTP requests.
  
  Args:
      cmd: The command to run.
      timeout: The command timeout in seconds.
      exit_on_fail: Whether to sys exit on failure.
      port_forward: List of (local, remote) ports to forward, or
          a single tuple.
      with_output: Whether to return output.
      environment_variables (Dict[str, str | int | Dict[str, str]):
          Environment variables that `cmd` should be run with.
      run_env: Options: docker/host/auto. Used in
          DockerCommandRunner to determine the run environment.
      ssh_options_override_ssh_key: if provided, overwrites
          SSHOptions class with SSHOptions(ssh_options_override_ssh_key).
      shutdown_after_run: if provided, shutdowns down the machine
      after executing the command with `sudo shutdown -h now`.
docstr_tok: ["Run","the","given","command","on","the","cluster","node","and","optionally","get","output",".","WARNING",":","the","cloudgateway","needs","arguments","of","``","run","''","function","to","be","json","dumpable","to","send","them","over","HTTP","requests",".","Args",":","cmd",":","The","command","to","run",".","timeout",":","The","command","timeout","in","seconds",".","exit_on_fail",":","Whether","to","sys","exit","on","failure",".","port_forward",":","List","of","(","local",",","remote",")","ports","to","forward",",","or","a","single","tuple",".","with_output",":","Whether","to","return","output",".","environment_variables","(","Dict","[","str",",","str","|","int","|","Dict","[","str",",","str","]",")",":","Environment","variables","that","`","cmd","`","should","be","run","with",".","run_env",":","Options",":","docker\/host\/auto",".","Used","in","DockerCommandRunner","to","determine","the","run","environment",".","ssh_options_override_ssh_key",":","if","provided",",","overwrites","SSHOptions","class","with","SSHOptions","(","ssh_options_override_ssh_key",")",".","shutdown_after_run",":","if","provided",",","shutdowns","down","the","machine","after","executing","the","command","with","`","sudo","shutdown","-h","now","`","."]
code: def run(
      self,
      cmd: Optional[str] = None,
      timeout: int = 120,
      exit_on_fail: bool = False,
      port_forward: List[Tuple[int, int]] = None,
      with_output: bool = False,
      environment_variables: Optional[Dict[str, object]] = None,
      run_env: str = "auto",
      ssh_options_override_ssh_key: str = "",
      shutdown_after_run: bool = False,
  ) -> str:
      """Run the given command on the cluster node and optionally get output.
  
      WARNING: the cloudgateway needs arguments of "run" function to be json
          dumpable to send them over HTTP requests.
  
      Args:
          cmd: The command to run.
          timeout: The command timeout in seconds.
          exit_on_fail: Whether to sys exit on failure.
          port_forward: List of (local, remote) ports to forward, or
              a single tuple.
          with_output: Whether to return output.
          environment_variables (Dict[str, str | int | Dict[str, str]):
              Environment variables that `cmd` should be run with.
          run_env: Options: docker/host/auto. Used in
              DockerCommandRunner to determine the run environment.
          ssh_options_override_ssh_key: if provided, overwrites
              SSHOptions class with SSHOptions(ssh_options_override_ssh_key).
          shutdown_after_run: if provided, shutdowns down the machine
          after executing the command with `sudo shutdown -h now`.
      """
      raise NotImplementedError
  
file_path: ray/python/ray/autoscaler/command_runner.py
imports: from typing import Any, Dict, List, Optional, Tuple
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 1 for calling the CommandRunnerInterface obj's underlying member method code with example usage: obj.run(cmd, timeout, exit_on_fail, port_forward, with_output, environment_variables, run_env, ssh_options_override_ssh_key, shutdown_after_run) without return types