jobflow_remote.remote.host.base module#

class jobflow_remote.remote.host.base.BaseHost[source]#

Bases: MSONable

Base Host class.

abstract close() bool[source]#
abstract connect()[source]#
abstract copy(src, dst)[source]#
abstract 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 host.

Parameters:
  • command (str or list of str) – Command to execute, as a str or list of str

  • workdir (str or None) – path where the command will be executed.

abstract get(src, dst)[source]#
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.

abstract property is_connected: bool#
abstract listdir(path: str | Path) list[str][source]#
abstract mkdir(directory: str | Path, recursive: bool = True, exist_ok: bool = True) bool[source]#

Create directory on the host.

abstract put(src, dst)[source]#
abstract remove(path: str | Path)[source]#
abstract rmtree(path: str | Path, raise_on_error: bool = False) bool[source]#

Recursively delete a directory tree on a host.

This method must be implemented by subclasses of BaseHost. It is intended to remove an entire directory tree, including all files and subdirectories, on the host represented by the subclass.

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:

bool

test() str | None[source]#
abstract write_text_file(filepath, content)[source]#

Write content to a file on the host.

exception jobflow_remote.remote.host.base.HostError[source]#

Bases: Exception