Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AIScientists Dev WorldSeed EC2Runner

From Leeroopedia
Knowledge Sources
Domains Distributed_Computing
Last Updated 2026-10-26 18:00 GMT

Overview

Concrete HTTP client for the always-on EC2 training daemon that submits training jobs and polls for results, with GPU pool management for concurrent experiment execution.

Description

The EC2Runner class is a thin HTTP client to the remote training daemon on EC2. Config via env vars:

  • `AUTORESEARCH_DAEMON_URL` — e.g. `http://3.82.x.y:8765` (required)
  • `AUTORESEARCH_DAEMON_TOKEN` — shared secret for auth (required)
  • `AUTORESEARCH_JOB_TIMEOUT` — max seconds to reconcile one job

If either is unset, `EC2Runner.enabled` is False and the worker emits `experiment_crashed` with reason `daemon_not_configured`.

The daemon exposes a job API:

  • `POST /jobs → {job_id}` — submit training
  • `GET /jobs/{job_id}` — poll status (queued/running/succeeded/failed/timed_out/cancelled)

The GPUPool class allocates GPU ids 0..n-1 to concurrent training requests. FIFO queue; `acquire()` blocks until a GPU frees up, `release()` is sync and non-blocking.

Usage

Import these classes for remote training dispatch. In production, the `AutoresearchWorker` creates and uses an `EC2Runner` instance.

Code Reference

Source Location

  • Repository: WorldSeed
  • File: src/worldseed/autoresearch/ec2_runner.py

Signature

@dataclass
class TrainingResult:
    val_loss: float | None
    wall_time: float
    crash_reason: str | None
    stdout_tail: str = ""

class GPUPool:
    def __init__(self, n: int) -> None: ...
    async def acquire(self) -> int: ...
    def release(self, gpu_id: int) -> None: ...
    @property
    def size(self) -> int: ...

class EC2Runner:
    def __init__(
        self,
        base_url: str | None = None,
        auth_token: str | None = None,
        request_timeout: float = 30.0,
    ) -> None: ...

Import

from worldseed.autoresearch.ec2_runner import EC2Runner, GPUPool, TrainingResult

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment