Interruption and teardown
Quick answer
Interruptible compute can reduce hourly charges, but recovery and waiting add cost and deadline risk. A teardown plan prevents forgotten resources from continuing to consume budget. Examples use small synthetic inputs and dependency-free Python. No cloud calls. ByteMind execution is unverified.
Compute work lost after interruption
progress=47; interval=15print(progress//interval*interval, progress%interval)Expected output (locally tested): 45 2. Resume from the last committed 45-minute checkpoint.
How it works
An interruption loses work after the last committed checkpoint. For a deterministic scenario with productive progress P, checkpoint interval C, last commit floor(P/C)*C, lost work is P minus that commit. Include checkpoint write duration, restart initialization, waiting time and retry limits. An interrupted upload is not a committed checkpoint. Resume only compatible, verified state; restore optimizer, step, data cursor and RNG where required. Managed spot training can support checkpoint-based recovery, but actual availability and billing depend on service terms. Model a deadline with both billed runtime and nonbilled queue time; do not infer expected savings from a single failure case. Define resource owner, expiry and cleanup actions before a job starts: stop/cancel jobs, scale down or delete authorized ephemeral endpoints and compute, remove temporary volumes/caches, retain approved versioned artifacts and audit logs according to retention policy, revoke temporary access and check cost reports. Inventory resources by job ID and ownership; never delete shared or protected resources. Repeated cleanup should be safe and missing resources should not cause destructive fallback. This is a plan only, not an actual teardown.
Choose owned ephemeral resources
resources=[("job",True,False),("shared",False,False),("audit",True,True)]print([name for name,owned,retain in resources if owned and not retain])Expected output (locally tested): ['job']. Shared and retention-protected resources are excluded.
Common mistakes
Do not assume an interruption notice always arrives or a checkpoint finishes instantly. Do not delete shared storage to save money. Stopping a training job does not necessarily stop separately deployed endpoints.
Practice and next steps
Calculate lost work if progress is 47 minutes with committed checkpoints every 15 minutes. Add a five-minute restart and compare the updated deadline and budget. Write a cleanup checklist without running cloud commands.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Interruption and teardown — knowledge check
Apply interruption and teardown to small examples and debugging scenarios.
Which checkpoint should be resumed?
What increases wall-clock duration without necessarily increasing billed compute?
What should cleanup exclude?
What does spot pricing guarantee?
What should a retry policy include?