The core finding
When interruptions arrive faster than the two-minute warning window, reacting to the notice stops helping. Across 80 trials at MTBF = 120 s, prediction wasted zero compute and recovered 12× faster than periodic checkpointing.
scroll to expand
EC2 Spot gives you a two-minute warning. The standard answer is to catch it and checkpoint. Over 80 trials at MTBF = 120 s, that reactive arm still burned 169.4 s of wasted compute — barely better than no protection at all (202.3 s) — because interruptions arrived faster than the notice window could absorb. Predicting the interruption instead brought wasted compute to 0.0 s and mean recovery to 5.4 s, against 65.7 s for periodic checkpointing.
Spot instances are 70–90% cheaper than on-demand, which makes them the obvious home for long training runs — right up until a reclaim throws away an afternoon of gradient steps. Argus treats that as a scheduling problem rather than a retry problem: a risk model watches the market, a Kubernetes operator acts on the risk score before the notice arrives, and the training job itself only ever has to answer one question — "should I flush a checkpoint right now?"
The reconcile loop is a kopf timer on a custom resource. Every 60 seconds it polls the prediction service for the job's instance type and AZ, records the score on the CR status and on a Prometheus gauge, and does nothing at all while risk stays under the threshold.
When risk crosses it, the operator does not reach into the trainer. It writes a _FLUSH_TRIGGER marker to S3 — the training pod polls that key every 100 batches, writes model.pt, and deletes the marker. The contract is a single object in a bucket, so the operator and the training process share no code and can be replaced independently.
Only then does it cordon the node and reschedule the pod onto the next instance type in the CR's instanceFallback list, publishing an SQS event on the way out. Phase transitions (Running → Checkpointing → Migrating) are guarded so a second reconcile can't double-migrate a job already in flight.
The whole AWS footprint — VPC, EKS control plane and Spot node groups, S3, SQS, ECR, Lambda and the IAM roles — is Terraform. Pods reach AWS through IRSA/OIDC, so there are no static credentials anywhere in the cluster.
@kopf.timer("argus.io", "v1", "spotresilientjobs", interval=POLL_INTERVAL) def reconcile(spec, name, namespace, status, patch, **kw): # Already migrating? leave it alone. if status.get("phase") in ("Checkpointing", "Migrating", "Succeeded"): return # 1. Poll the prediction service risk_score = httpx.get( f"{PREDICT_SERVICE_URL}/predict", params={"instance_type": instance_type, "az": "eu-north-1a"}, ).json()["risk_score"] risk_score_gauge.labels(job_name=name).set(risk_score) if risk_score <= risk_threshold: return # 2. Checkpoint via S3 marker — no trainer coupling patch.status["phase"] = "Checkpointing" trigger_s3_checkpoint(name, checkpoint_path) checkpoint_count.labels(job_name=name).inc() # 3. Cordon the doomed node, reschedule the pod patch.status["phase"] = "Migrating" scheduler.cordon_node(scheduler.get_pod_node(name, namespace)) scheduler.reschedule_pod(name, namespace, fallback_types)
Wasted compute per arm at MTBF = 120 s — bars share one scale (0–202.3 s). Lower is better; the predictive arm's bar is empty because it wasted nothing.
| Arm | Wasted compute | Recovery |
|---|---|---|
| No protection | 202.3 s | — |
| Reactive | 169.4 s | 58.8 s |
| Periodic | 4.3 s | 65.7 s |
| Predictive | 0.0 s | 5.4 s |
The end-to-end drill on a live EKS cluster — training was at epoch 7 on a Spot node when the interruption landed.
| Time (UTC) | Event |
|---|---|
| 12:26:18 | NTH receives the interruption warning |
| 12:26:19 | SIGTERM handler writes epoch-8 checkpoint to S3 |
| 12:26:25 | Node cordoned and drained — 10 s end to end |
| + ~75 s | Replacement pod resumes from epoch 8 |
Stated limitation: the interruption was a schema-conformant message injected into the Node Termination Handler's queue, not an AWS FIS-issued reclaim. Everything downstream of that message — drain, checkpoint, cordon, reschedule, resume — ran on real EKS against real S3.
The risk model is likewise advisory-grade: 14.68× base-rate lift (5-seed mean, 95% CI ≈ [9.9×, 19.5×]) on live eu-north-1 price history, trained against a price-spike proxy rather than reclaim ground truth.
A $66 EKS cluster left running overnight paid for the last piece: every session now ends with an all-region teardown sweep, which kept the whole project inside its $100 credit.