learning-it by example

Back to the video

Checkpoint and Resume: Crash Without Sending Twice

My job crashed, I restarted it, and it sent the same email twice.

Video #38 ยท AI agents and MCP

Steps in the video

  1. 0:00 My job sent the email twice
  2. 0:25 The idea
  3. 1:02 Setup
  4. 1:26 Six steps
  5. 1:53 The runner
  6. 2:22 Four cases
  7. 2:44 Count the work
  8. 3:29 What this does not show
  9. 4:02 Mistakes to avoid
  10. 4:25 My take and next steps
  11. 4:54 Recap

Files

  • compare.py (24 lines)
  • runner.py (22 lines)
  • tasks.py (37 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

The crash is a raised error, not a killed process. One crash point per case and six made-up steps. The email is a line in a file. The key check reads a file, so it does not protect two workers running at once. No database, locks or retries.

Sources

Learning IT by Example.