Skip to content

Day 2 — Scaffold minipipe: Job, Result, Runner, LocalRunner #2

Description

@Camarent

Goal

Scaffold the repo and implement the core types. Architecture was settled 2026-07-31 — build to the spec, don't redesign.

  • Repo skeleton copied from logstats: src layout, pyproject, mypy strict, ruff, pytest, CI workflow
  • logstats as a uv git dependency (track branch during Week 3; pin a tag at the checkpoint)
  • Job, Result, RunConfig as pydantic models
  • Runner Protocol
  • LocalRunner (sequential, in-process)
  • workloads/logs.py created — the only module allowed to import logstats
  • .gitignore: data/ (generated logs are never committed)
  • CLI skeleton with two subcommands: minipipe run and minipipe worker <spec.json>
  • Architecture sketch (fetch/parse fan-out → aggregate fan-in → report)

Spec

Job(id: str, stage: str, shard: int, inputs: list[str], output: str)
Result(job_id: str, ok: bool, output: str | None, error: str | None, duration: float)
Runner.run(jobs: list[Job]) -> list[Result]      # Protocol; sync, takes a whole wave

Jobs cross process boundaries. Job must be JSON-serializable and communicate only through paths — never live Python objects. LocalRunner doesn't need this; Slurm (W5) and K8s (W6) do, and designing for it now is what makes them drop-in.

Runner.run is sync and takes a list because that is how every real backend works — a Slurm job array, a K8s Job with parallelism: N. Submit the wave, wait, collect. Async stays an implementation detail inside a stage.

A single job must be runnable on its own. Slurm launches an array element and K8s runs a
Job pod — neither runs minipipe run; each runs one job from a spec. So minipipe worker <spec.json> is part of the contract, not a convenience. Stub it here; it dispatches for real
in #3.

RunConfig (run_id, shards, level, top) is written once to runs/<run_id>/config.json at submit time; every stage loads and validates it. No per-stage payload models until stages genuinely diverge.

Done when: minipipe imports, mypy strict is clean, and LocalRunner executes a trivial job list.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions