Skip to navigation

nemo_gym.orchestration.executors.connection

View as MarkdownOpen in Claude

Module Contents

Classes

NameDescription
Connection-
LocalConnection-
SSHConnectionSingle SSH master connection; copy and all commands reuse the same socket.

Functions

NameDescription
_checked-
_checked_holding_inputLike _checked, but stdin stays open until the command exits, so its EOF on the far end means that this
_read_stderr_forwarding_progressKeep all of stderr for the error message, and pass each progress line on as it arrives.
get_connection-

Data

READER_PROGRESS_PREFIX

API

class nemo_gym.orchestration.executors.connection.Connection()
Abstract
nemo_gym.orchestration.executors.connection.Connection.__exit__(
_ = ()
) -> None
nemo_gym.orchestration.executors.connection.Connection.close() -> None
nemo_gym.orchestration.executors.connection.Connection.copy(
local: pathlib.Path,
remote: pathlib.Path
) -> None
abstract
nemo_gym.orchestration.executors.connection.Connection.run(
commands: list[str]
) -> str
abstract
nemo_gym.orchestration.executors.connection.Connection.write_text(
remote: pathlib.Path,
content: str,
private: bool = False
) -> None
abstract
class nemo_gym.orchestration.executors.connection.LocalConnection()

Bases: Connection

nemo_gym.orchestration.executors.connection.LocalConnection.copy(
local: pathlib.Path,
remote: pathlib.Path
) -> None
nemo_gym.orchestration.executors.connection.LocalConnection.run(
commands: list[str]
) -> str
nemo_gym.orchestration.executors.connection.LocalConnection.run_with_input_held(
commands: list[str]
) -> str
nemo_gym.orchestration.executors.connection.LocalConnection.write_text(
remote: pathlib.Path,
content: str,
private: bool = False
) -> None
class nemo_gym.orchestration.executors.connection.SSHConnection(
hostname: str
)

Bases: Connection

Single SSH master connection; copy and all commands reuse the same socket.

_MASTER_TIMEOUT
= 10
_OPTS
_master
Popen | None = None
_socket
nemo_gym.orchestration.executors.connection.SSHConnection._ssh_opts() -> list[str]
nemo_gym.orchestration.executors.connection.SSHConnection._wait_for_socket() -> None
nemo_gym.orchestration.executors.connection.SSHConnection.close() -> None
nemo_gym.orchestration.executors.connection.SSHConnection.copy(
local: pathlib.Path,
remote: pathlib.Path
) -> None
nemo_gym.orchestration.executors.connection.SSHConnection.run(
commands: list[str]
) -> str
nemo_gym.orchestration.executors.connection.SSHConnection.run_with_input_held(
commands: list[str]
) -> str
nemo_gym.orchestration.executors.connection.SSHConnection.write_text(
remote: pathlib.Path,
content: str,
private: bool = False
) -> None
nemo_gym.orchestration.executors.connection._checked(
cmd: list[str],
input: str | None = None,
context: str = ''
) -> str
nemo_gym.orchestration.executors.connection._checked_holding_input(
cmd: list[str],
input: str,
context: str = ''
) -> str

Like _checked, but stdin stays open until the command exits, so its EOF on the far end means that this process or its connection is gone. The commands must end the remote shell themselves (exit).

Progress lines on the command’s stderr (READER_PROGRESS_PREFIX) reach this process’s stderr while it runs; stdout is returned whole, as before.

nemo_gym.orchestration.executors.connection._read_stderr_forwarding_progress(
stream,
output: dict[str, str]
) -> None

Keep all of stderr for the error message, and pass each progress line on as it arrives.

nemo_gym.orchestration.executors.connection.get_connection(
hostname: str | None
nemo_gym.orchestration.executors.connection.READER_PROGRESS_PREFIX = 'gym-reader progress:'