jobflow_remote.remote.host.separated module#
Host implementation that uses separate connections for commands and file transfers.
This is useful for HPC systems where login nodes have SFTP disabled but a dedicated data transfer node is available (e.g., LRC at LBNL).
- class jobflow_remote.remote.host.separated.SeparatedTransferHost(command_host: RemoteHost, transfer_host: RemoteHost)[source]#
Bases:
BaseHostHost that delegates commands and file transfers to separate connections.
This enables HPC systems where:
Login node: SSH/scheduler commands work, but SFTP is disabled
Transfer node: SFTP works, but scheduler commands don’t work
Command execution (execute, shell) goes through the command_host. File operations (put, get, mkdir, etc.) go through the transfer_host.
- Parameters:
command_host (RemoteHost) – Host for executing commands (e.g., login node with SLURM access).
transfer_host (RemoteHost) – Host for file transfers (e.g., data transfer node with SFTP).
sanitize – If True text a string will be prepended and appended to the output of the commands, to ease the parsing and avoid failures due to spurious text coming from the host shell.
- close() bool[source]#
Close connections to both hosts.
- Returns:
True if both connections were closed successfully.
- Return type:
- execute(command: str | list[str], workdir: str | Path | None = None, timeout: int | None = None) tuple[str, str, int][source]#
Execute the given command on the command host.
- Parameters:
- Returns:
stdout (str) – Standard output of the command.
stderr (str) – Standard error of the command.
exit_code (int) – Exit code of the command.
- property interactive_login: bool#
Check if either host requires interactive login.
- Returns:
True if either host requires interactive login.
- Return type:
- property is_connected: bool#
Check if both connections are open.
- Returns:
True if both command and transfer hosts are connected.
- Return type:
- mkdir(directory: str | Path, recursive: bool = True, exist_ok: bool = True) bool[source]#
Create directory on the command host.
- remove(path: str | Path) None[source]#
Remove a file on the transfer host.
- Parameters:
path (str or Path) – Path to the file to remove.
- rmtree(path: str | Path, raise_on_error: bool = False) bool[source]#
Recursively delete a directory tree on the command host.