bundle.lambdalabs.runner

Lambda Labs remote job runner — full lifecycle management.

Attributes

Classes

RemoteJob

Manages a single remote training job on Lambda Labs.

Module Contents

bundle.lambdalabs.runner.log
bundle.lambdalabs.runner.BUNDLE_INSTALL_CMD = 'pip install --quiet thebundle 2>/dev/null || pip install --quiet...
class bundle.lambdalabs.runner.RemoteJob(config: bundle.lambdalabs.config.LambdaLabsConfig | None = None, api_key: str | None = None, ssh_key_path: pathlib.Path | None = None, ssh_user: str = 'ubuntu', auto_terminate: bool = False, filesystem_name: str | None = None)

Manages a single remote training job on Lambda Labs.

Lifecycle:
  1. launch() — start a GPU instance (or attach to an existing one)

  2. wait() — poll until active + has IP

  3. setup() — install bundle on the remote instance

  4. upload() — rsync local workspace → remote (skips unchanged files)

  5. run() — execute a command via SSH

  6. download() — rsync remote results → local

  7. terminate()— shut down the instance (optional)

Filesystem mode (recommended):

Pass filesystem_name to mount a Lambda Labs persistent NFS volume. The workspace lives at /home/ubuntu/<filesystem_name>/ and survives instance termination — images and SfM output are never re-uploaded. Only the small runs/ results are downloaded after each job.

config
ssh_key_path
ssh_user = 'ubuntu'
auto_terminate = False
filesystem_name: str
instance: bundle.lambdalabs.models.Instance | None = None
async launch(instance_type: str | None = None, ssh_key_name: str | None = None, region: str | None = None, name: str | None = None, instance_id: str | None = None) → bundle.lambdalabs.models.Instance

Launch a new instance or attach to an existing one by ID.

async wait(timeout: float = 600) → bundle.lambdalabs.models.Instance

Poll until the instance is active with an IP.

async setup() → None

Install bundle on the remote instance.

async upload(local: pathlib.Path, remote: pathlib.Path, skip_existing: bool = False) → None

rsync local directory → remote instance.

When skip_existing=True (set automatically in filesystem mode), files already on the remote are not re-transferred — saving time and bandwidth for large image datasets on subsequent runs.

async download(remote: pathlib.Path, local: pathlib.Path) → None

rsync remote directory → local.

async run(command: str) → None

Execute a shell command on the remote instance via SSH.

async terminate() → None

Terminate the instance.