Level 4 / Project 14 - Configurable Batch Runner¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | Browser |
Estimated time: 75 minutes
Focus¶
- batch jobs driven by config files
Why this project exists¶
This project gives you level-appropriate practice in a realistic operations context. Goal: run the baseline, alter behavior, break one assumption, recover safely, and explain the fix.
Run (copy/paste)¶
Use <repo-root> as the folder containing this repository's README.md.
cd <repo-root>/projects/level-4/14-configurable-batch-runner
python project.py --config data/batch_config.json --output data/batch_report.json
pytest -q
Expected terminal output¶
Expected artifacts¶
data/batch_report.json— per-job results with status- Passing tests
- Updated
notes.md
Checkpoint: Baseline code runs and all tests pass. Commit your work before continuing.
Alter it (required) — Extension¶
- Add a new action:
search_patternthat counts regex matches in a file. - Add a
--dry-runflag that validates the config without executing jobs. - Re-run script and tests — add a test for the new action.
Break it (required) — Core¶
- Reference a non-existent file in the config and verify the error is logged per-job.
- Add a job with an unknown action name and confirm it is skipped.
- Create a config with zero jobs and verify the runner handles it.
Fix it (required) — Core¶
- Add config schema validation (each job must have name, action, input).
- Add timing to each job result (duration_ms).
- Re-run until all tests pass.
Checkpoint: All modifications done, tests still pass. Good time to review your changes.
Explain it (teach-back)¶
- Why does the batch runner use an
ACTIONSregistry instead ofif/elifchains? - What is the advantage of running jobs sequentially with individual error handling vs. stopping at first failure?
- Why does
run_batchresolve input paths relative to the config file's directory? - How would you extend this to support job dependencies (job B runs only if job A succeeds)?
Mastery check¶
You can move on when you can: - run baseline without docs, - explain one core function line-by-line, - break and recover in one session, - keep tests passing after your change.
Related Concepts¶
| ← Prev | Home | Next → |
|---|---|---|