> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.orchestration.executors.connection

## Module Contents

### Classes

| Name                                                                              | Description                                                                |
| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`Connection`](#nemo_gym-orchestration-executors-connection-Connection)           | -                                                                          |
| [`LocalConnection`](#nemo_gym-orchestration-executors-connection-LocalConnection) | -                                                                          |
| [`SSHConnection`](#nemo_gym-orchestration-executors-connection-SSHConnection)     | Single SSH master connection; copy and all commands reuse the same socket. |

### Functions

| Name                                                                            | Description |
| ------------------------------------------------------------------------------- | ----------- |
| [`_checked`](#nemo_gym-orchestration-executors-connection-_checked)             | -           |
| [`get_connection`](#nemo_gym-orchestration-executors-connection-get_connection) | -           |

### API

```python
class nemo_gym.orchestration.executors.connection.Connection()
```

Abstract

```python
nemo_gym.orchestration.executors.connection.Connection.__enter__() -> nemo_gym.orchestration.executors.connection.Connection
```

```python
nemo_gym.orchestration.executors.connection.Connection.__exit__(
    _ = ()
) -> None
```

```python
nemo_gym.orchestration.executors.connection.Connection.close() -> None
```

```python
nemo_gym.orchestration.executors.connection.Connection.copy(
    local: pathlib.Path,
    remote: pathlib.Path
) -> None
```

abstract

```python
nemo_gym.orchestration.executors.connection.Connection.run(
    commands: list[str]
) -> str
```

abstract

```python
class nemo_gym.orchestration.executors.connection.LocalConnection()
```

**Bases:** [Connection](#nemo_gym-orchestration-executors-connection-Connection)

```python
nemo_gym.orchestration.executors.connection.LocalConnection.copy(
    local: pathlib.Path,
    remote: pathlib.Path
) -> None
```

```python
nemo_gym.orchestration.executors.connection.LocalConnection.run(
    commands: list[str]
) -> str
```

```python
class nemo_gym.orchestration.executors.connection.SSHConnection(
    hostname: str
)
```

**Bases:** [Connection](#nemo_gym-orchestration-executors-connection-Connection)

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

**`_MASTER_TIMEOUT`** `= 10`

---

**`_OPTS`**

---

**`_master`** `Popen | None = None`

---

**`_socket`**

---

```python
nemo_gym.orchestration.executors.connection.SSHConnection.__enter__() -> nemo_gym.orchestration.executors.connection.SSHConnection
```

```python
nemo_gym.orchestration.executors.connection.SSHConnection._ssh_opts() -> list[str]
```

```python
nemo_gym.orchestration.executors.connection.SSHConnection._wait_for_socket() -> None
```

```python
nemo_gym.orchestration.executors.connection.SSHConnection.close() -> None
```

```python
nemo_gym.orchestration.executors.connection.SSHConnection.copy(
    local: pathlib.Path,
    remote: pathlib.Path
) -> None
```

```python
nemo_gym.orchestration.executors.connection.SSHConnection.run(
    commands: list[str]
) -> str
```

```python
nemo_gym.orchestration.executors.connection._checked(
    cmd: list[str],
    input: str | None = None,
    context: str = ''
) -> str
```

```python
nemo_gym.orchestration.executors.connection.get_connection(
    hostname: str | None
) -> nemo_gym.orchestration.executors.connection.Connection
```