o
    b²“iˆ  ã                   @   s>   d dl mZmZmZmZmZ d dlmZ eG dd„ dƒƒZdS )é    )ÚAnyÚDictÚListÚOptionalÚTuple)ÚDeveloperAPIc                   @   sþ   e Zd ZdZ									d!dee ded	ed
eee	eef   dedee
eef  dedededefdd„Z	d"dededee
eef  ddfdd„Z	d"dededee
eef  ddfdd„Zdefdd„Zdede
eef dedee fdd „ZdS )#ÚCommandRunnerInterfacea¿  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().Néx   FÚautoÚ ÚcmdÚtimeoutÚexit_on_failÚport_forwardÚwith_outputÚenvironment_variablesÚrun_envÚssh_options_override_ssh_keyÚshutdown_after_runÚreturnc
           
      C   ó   t ‚)a@  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`.
        ©ÚNotImplementedError)
Úselfr   r   r   r   r   r   r   r   r   © r   úQ/home/ubuntu/.local/lib/python3.10/site-packages/ray/autoscaler/command_runner.pyÚrun   s   !zCommandRunnerInterface.runÚsourceÚtargetÚoptionsc                 C   r   )z¨Rsync files up to the cluster node.

        Args:
            source: The (local) source directory or file.
            target: The (remote) destination path.
        r   ©r   r   r   r   r   r   r   Úrun_rsync_up5   ó   	z#CommandRunnerInterface.run_rsync_upc                 C   r   )z¬Rsync files down from the cluster node.

        Args:
            source: The (remote) source directory or file.
            target: The (local) destination path.
        r   r    r   r   r   Úrun_rsync_down@   r"   z%CommandRunnerInterface.run_rsync_downc                 C   r   )z4Return the command the user can use to open a shell.r   )r   r   r   r   Úremote_shell_command_strK   s   z/CommandRunnerInterface.remote_shell_command_strÚas_headÚfile_mountsÚsync_run_yetc                C   s   dS )a?  Used to run extra initialization commands.

        Args:
            as_head: Run as head image or worker.
            file_mounts: Files to copy to the head and worker nodes.
            sync_run_yet: Whether sync has been run yet.

        Returns:
            optional: Whether initialization is necessary.
        Nr   )r   r%   r&   r'   r   r   r   Úrun_initO   s   zCommandRunnerInterface.run_init)	Nr	   FNFNr
   r   F)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚstrÚintÚboolr   r   r   Úobjectr   r   r!   r#   r$   r(   r   r   r   r   r      s|    öþýüûúùø	÷
ö
õ$ÿÿÿÿ
þÿÿÿÿ
þÿ
ÿÿþr   N)	Útypingr   r   r   r   r   Úray.util.annotationsr   r   r   r   r   r   Ú<module>   s    