jobflow_remote.remote.host.remote module#
- class jobflow_remote.remote.host.remote.Interactive(username)[source]#
Bases:
AuthSource
Interactive AuthSource. Prompts the user for all the requests coming from the server.
- class jobflow_remote.remote.host.remote.InteractiveAuthStrategy(ssh_config, fabric_config, username)[source]#
Bases:
OpenSSHAuthStrategy
AuthStrategy based on OpenSSHAuthStrategy that tries to use public keys and then switches to an interactive approach forwarding the requests from the server.
Extends superclass with additional inputs.
Specifically:
fabric_config
, a fabric.Config instance for the current session.username
, which is unified by our intended caller so we don’t have to - it’s a synthesis of CLI, runtime, invoke/fabric-configuration, and ssh_config configuration.
Also handles connecting to an SSH agent, if possible, for easier lifecycle tracking.
- get_sources()[source]#
Generator yielding AuthSource instances, in the order to try.
This is the primary override point for subclasses: you figure out what sources you need, and
yield
them.Subclasses _of_ subclasses may find themselves wanting to do things like filtering or discarding around a call to super.
- class jobflow_remote.remote.host.remote.RemoteHost(host, user=None, port=None, config=None, gateway=None, forward_agent=None, connect_timeout=None, connect_kwargs=None, inline_ssh_env=None, timeout_execute=None, keepalive=60, shell_cmd='bash', login_shell=True, retry_on_closed_connection=True, interactive_login=False)[source]#
Bases:
BaseHost
Execute commands on a remote host. For some commands assumes the remote can run unix.
- property connection#
- execute(command: str | list[str], workdir: str | Path | None = None, timeout: int | None = None)[source]#
Execute the given command on the host.
- property interactive_login: bool#
True if the host requires interactive actions upon login. False by default. Subclasses should override the method to customize the value.
- mkdir(directory: str | Path, recursive: bool = True, exist_ok: bool = True) bool [source]#
Create directory on the host.
- rmtree(path: str | Path, raise_on_error: bool = False) bool [source]#
Recursively delete a directory tree on a remote host.
It is intended to remove an entire directory tree, including all files and subdirectories, on this remote host.
- Parameters:
path (str or Path) – The path to the directory tree to be removed.
raise_on_error (bool) – If set to False (default), errors will be ignored, and the method will attempt to continue removing remaining files and directories. Otherwise, any errors encountered during the removal process will raise an exception.
- Returns:
True if the directory tree was successfully removed, False otherwise.
- Return type: