Skip to content

utils

utils

Shared primitives for remote execution providers.

RunResult(returncode: int, stdout: str, stderr: str) dataclass

Result of a remote command.

ok: bool property

Return whether the remote command succeeded.

ShipResult(provider: str, host: str, directory: str, bootstrap: str, dispatch: str, logs: tuple[str, ...], job_ids: tuple[str, ...], remote: RunResult) dataclass

Remote artifacts and process identities created for a dispatch.

ok: bool property

Return whether every requested remote launch was accepted.

uv_groups_for_cpu(groups: Iterable[str]) -> list[str]

Replace an accelerator dependency flavor with the CPU flavor.

place(minimum: int, capacities: list[int], limit: int | None = None) -> tuple[int, ...] | None

Return the smallest homogeneous machine layout satisfying a request.

run(command: str | list[str], host: str, timeout: float | None = None, max_attempts: int | None = None) -> RunResult

Run a command remotely through an SSH login shell.

Transient connection failures are retried with per-host adaptive backoff. Pass max_attempts=1 for commands whose remote effects must not be repeated.

copy(source: str | Path, host: str, destination: str, timeout: float | None = None) -> RunResult

Copy one local file or directory onto a remote host.