Repository navigation
Description
Summary
AWS spot instance reclamation is increasingly interrupting our GPU notebook builds mid-run across the lecture repos. Because these builds run on a single g4dn.2xlarge GPU for 15–25 minutes and can't cheaply checkpoint, a reclamation near the end discards the whole run — and with it any spot savings. This is happening often enough that it's now a reliability problem worth tracking centrally rather than patching per-repo.
Most recent example
The weekly cache.yml build in lecture-jax was killed at 91% of execution: https://github.com/QuantEcon/lecture-jax/actions/runs/27929889850
The runner was a spot instance (Runner details (g4dn.2xlarge, spot, v3.1.1), InstanceLifecycle: spot). At 04:54:43, while Sphinx was at reading sources... [91%], the log shows The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled, immediately followed by The operation was canceled. The AssertionError: self.km is not None raised by nbclient cleanup is a symptom of the kernel being torn down mid-execution — there was no actual notebook/cell error (32 of 33 lectures had already executed cleanly).
Impact
- Wasted GPU minutes — a reclamation at 90% throws away ~20 min of g4dn time, so the spot discount is often a net loss on long builds.
- Flaky scheduled caches & publishes — the weekly cache and
publish*builds intermittently fail for reasons unrelated to the lectures, requiring manual re-runs. - Noise — the failure surfaces as a Python
AssertionError/RuntimeErrortraceback, which looks like a content bug and costs triage time to rule out.
Affected repos
Any lecture repo using g4dn GPU RunsOn runners — at minimum lecture-jax (cache, ci, publish, collab workflows). Other GPU-using series likely share the same pattern and the same default-spot config.
Immediate mitigation (in progress)
Forcing on-demand by adding spot=false to the RunsOn runner spec. First PR: QuantEcon/lecture-jax#327.
Discussion — what should the org-wide default be?
Options, roughly in increasing order of effort:
- On-demand for long GPU builds (
cache,publish), keep spot for short/cheap PR jobs (ci,collab). Simple, mostly captures the reliability win where it matters. - On-demand for all GPU builds. Maximally reliable; higher cost. Worth it only if PR GPU jobs are also getting reclaimed.
- Keep spot but add automatic retry-on-reclamation (re-run failed job once) so a single reclamation self-heals without a green-button click.
- Tune the RunsOn spot strategy (e.g. capacity-optimized allocation, broader instance family pool) to reduce reclamation frequency while staying on spot.
A consistent default belongs here rather than drifting per-repo. Related runner-health/telemetry work: #328.
Asks
- Decide the org-wide GPU spot policy (one of the options above).
- Roll the chosen config to all GPU-using lecture repos.
- Optionally track GPU spot reclamation frequency as part of Server & build telemetry — operational dashboard for runner health, build performance & cost #328 runner-health telemetry.
Activity
mmcky commentedon Jun 26, 2026
Decision: roll out
spot=false(on-demand) to all GPU runners across QuantEconWe're going with on-demand for all GPU builds (option 2). The long, single-GPU notebook builds can't cheaply checkpoint, so a late-build reclamation wastes the whole run and any spot saving with it — on-demand reliability wins. Validated in
lecture-jaxvia QuantEcon/lecture-jax#327 (merged):spot=falseadded to the RunsOn spec in all four GPU workflows.Rollout — apply
/spot=falseto theg4dn.2xlargerunner spec in each GPU workflowlecture-jaxlecture-python.mystlecture-statslecture-python-programmingiuj_feb_2026(Repo list from an org-wide code search for
g4dn.2xlargein.github/workflows. Doc-only hits —QuantEcon.manual,actions,benchmarks,project-monorepo,status-lectures,tool-lecture-benchmark— need no change.)Follow-ups
QuantEcon/actionsso new GPU-using repos inherit on-demand rather than each repo carrying the flag — the durable fix vs. patching four repos by hand now.I can open the four follow-up PRs (one per repo, same one-line change) on request.
Force on-demand GPU runners (spot=false) (#936)
Force on-demand GPU runners (spot=false) (#936)
Run GPU builds on-demand: add spot=false to publish.yml (#603)
Run GPU builds on-demand: add spot=false to ci and publish (#6)
MAINT: consolidate GPU workflow config, bump download-artifact to v21 (…