Skip to content

nodus.process

View Markdown

Processes and files inside a running Job, Sandbox or Workspace (resources.md §3.6).

stdout, stderr and stdin use the long-poll protocol (output, stdin, signals), which needs no WebSocket and works through every proxy; a Process’s output is retained, so a reader that reconnects resumes from its offset. p.attach() opens the interactive remotecommand v5 WebSocket session instead, for terminals.

class Attach(ws: Any) -> None

Frames of a remotecommand v5 session: iterate for (stream, bytes); write, resize, close_stdin.

close_stdin() -> None

Type: int | None

Set once the session reports the process’s exit status.

resize(rows: int, cols: int) -> None
write(data: bytes | str) -> None
class File(files: _Files, path: str, mode: str) -> None

A file opened with sb.open(path, mode): reads come from one download, writes upload on close().

close() -> None
read(n: int = 1) -> str | bytes
write(data: str | bytes) -> int
class Files(client: Client, kind: str, name: str, project: str | None = None) -> None

The files subresource of a Job, Sandbox or Workspace.

list(path: str = '/') -> list[Obj]
open(path: str, mode: str = 'r') -> _File
read(path: str) -> bytes
remove(path: str) -> None
write(path: str, data: bytes | str, expected_sha256: str | None = None) -> None
class Process(client: Client, obj: Obj) -> None

One command executing in a running attempt: stdout, stderr, stdin, wait(), returncode.

attach(stdin: bool = True, tty: bool = False) -> AsyncIterator[_Attach]

An interactive session over the remotecommand v5 WebSocket (one stdin writer; many readers).

cancel() -> None

Type: str

resize(rows: int, cols: int) -> None

Type: int | None

The exit code once the process has finished, else None.

signal(sig: str) -> None

Send SIGINT, SIGTERM, SIGKILL, SIGHUP, SIGQUIT, SIGUSR1 or SIGUSR2.

start(client: Client, kind: str, parent: str, command: list[str], *, tty: bool = False, stdin: bool = False, env: dict[str, str] | None = None, workdir: str | None = None, timeout: str | None = None, project: str | None = None, **params: Any) -> _Process

Type: _StreamReader

Type: _StdinWriter

Type: _StreamReader

wait(timeout: float | None = None) -> int

Block until the process exits and return its exit code; TimeoutError after timeout seconds.

write(data: bytes | str) -> None
class StdinWriter(proc: _Process) -> None
drain() -> None

Writes are sent as they are made, so there is nothing buffered to flush.

write(data: bytes | str) -> None
write_eof() -> None
class StreamReader(proc: _Process, stream: str) -> None

stdout or stderr of a Process: read() returns everything; iterating yields text as it arrives.

read() -> str
read_bytes() -> bytes