Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .agents/skills/homebased/references/pools.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ homebased --json pool show afv
homebased --json pool release afv
```

- The pool name is the CI class. Submit one `ci run --class <pool>` per unit of work; the coordinator asks for a machine whenever ready jobs find no free slot, up to `--max`. Do not write a dispatcher loop. Once a pool is released, its class is the Fleet's again: a job submitted then waits for a Fleet machine that offers the class, and the old pool never fails it.
- The pool name is the CI class. Submit one `ci run --class <pool>` per unit of work; the coordinator asks for a machine whenever ready jobs find no free slot, up to `--max`. Do not write a dispatcher loop. `pool create` refuses a name a Fleet machine already offers as a CI class (`class_offered`, exit 5); pick another name. Once a pool is released, its class is the Fleet's again: a job submitted then waits for a Fleet machine that offers the class, and the old pool never fails it.
- `--deadline` is fixed at create (at most 24h). A job runs only on a machine that outlives its `--kill-after`, so a job that no machine of the pool could run to its kill limit, counting a new machine's boot, is refused with `pool_deadline_too_close`, and a waiting job that falls out of reach later (for example while its `--after` dependency runs) fails with `JOB_FAILED` carrying that code. The message names the longest `--kill-after` the pool takes now; size `--kill-after` to the job.
- `--env-file` holds `NAME=value` secrets, such as an upload token, on the coordinator. Machines get them after they join; never put a secret in a job's command line or the repository. A `PATH` in it applies inside the run only, so name a program outside the machine's default `PATH` by its full path or start it from a `--git` script.
- `--spend-cap` (US dollars, such as `25` or `12.50`) caps what the pool's cloudlease run may spend; cloudlease's own per-run cap applies without it, and a value above that cap ends the pool with `invalid_request`. Ask the user for the amount.
- `--slots` (default 1) is how many jobs one machine runs at once; `--idle-limit` (default 10m), `--stall-after` (default 30m), and `--boot-timeout` (by default a minute before cloudlease's boot grace ends, read from each lease, so 7m on DigitalOcean and 19m on phoenixNAP) tune the lifetime rules below. On a class whose boot grace is longer than 8 minutes, such as phoenixNAP, pass `--boot-timeout` (`19m`) so jobs submitted before the first machine exists are sized for that boot. `--boot-timeout` must be shorter than `--deadline`; `pool create` refuses an equal or longer value with `usage` (exit 2), so pick a later `--deadline` or a shorter boot timeout.
- `--slots` (default 1) is how many jobs one machine runs at once; `--idle-limit` (default 10m) and `--stall-after` (default 30m) tune the lifetime rules below. A machine that has not joined when cloudlease's boot grace ends (8 minutes by default, 20 on phoenixNAP) is deleted with reason `heartbeat_lapsed`, and the pool asks for another if jobs still wait.
- `--min-free-disk` (GiB, default 1) is the free disk below which a pool machine admits no job. Set it to what one job needs on disk, within what the machine class has free after boot, so a machine filled by earlier jobs stops taking new ones and idles out.
- Jobs run with `--git` (or `--repo` and `--commit`) from the pushed commit, or in a `cwd` that the boot leaves on the machine. A fresh machine has nothing else of yours on it.
- Private repositories work: the machine never gets a git credential. At submit the coordinator fetches the commit with its own git credentials and makes a one-commit bundle; the machine downloads it from the coordinator over the link when the run starts and checks it out. So the checkout is shallow (one commit, no tags). The submit is refused, before any machine is asked for, with `commit_unavailable` when the coordinator cannot fetch the commit (push it, or fix the remote or the coordinator's credentials), `submodules_unsupported` when the commit has a `.gitmodules`, or `bundle_too_large` past 2 GiB. A download that breaks is tried 3 times, with each failure in the run's log, before the run fails.
Expand All @@ -34,9 +34,9 @@ homebased --json pool release afv

## Interrupted machines

When the provider takes a machine back (reason `interrupted`, such as an AWS Spot interruption), the coordinator queues its jobs again for another machine and the pool asks for a replacement; do nothing. Each rerun shows as `JOB_PREEMPTED` with `machine_lost` (`pool`, `machine`, `reason`, `attempt` now queued, `max_attempts`, and `ends_at` when the machine gave notice), a progress event that does not wake a sleeping thread. On AWS the machine reads the two-minute Spot notice, so the job is queued again within seconds; the interrupted run keeps going until AWS shuts the machine down, and can watch the file named by `HOMEBASED_INTERRUPTION_FILE` to save a checkpoint off the machine.
When the provider takes a machine back (reason `interrupted`, such as an AWS Spot interruption), the coordinator queues its jobs again for another machine and the pool asks for a replacement; do nothing. Each rerun shows as `JOB_PREEMPTED` with `machine_lost` (`pool`, `machine`, `reason`, `attempt` now queued, `max_attempts`), a progress event that does not wake a sleeping thread. cloudlease notices an interrupted machine about a minute after the provider takes it, and the job is queued again then.

So a job on such a pool must be safe to run again and to overlap a dying copy of itself for up to two minutes: derive output names from the input, upload each output whole (write, then rename or put at once), and skip work whose output exists.
So a job on such a pool must be safe to run again: derive output names from the input, upload each output whole (write, then rename or put at once), and skip work whose output exists.

A rerun ends with `JOB_FAILED` and `machine_released` with `not_rerun.cause`: `retries_exhausted` (it ran `max_attempts` times), `out_of_reach` (no machine could run it to its kill limit before the deadline), `pool_ended`, `pinned`, or `cancelled` (a cancel was asked for first). A replacement past the spend cap is refused, which stops the pool and fails the queued job with `spend_cap_reached` in `held_ending`. Report a job that kept getting interrupted to the user rather than resubmitting it in a loop. `heartbeat_lapsed` is never rerun, since a stalled job would stall again.

Expand Down
Loading
Loading