Level 7 / Project 05 - Polling Cadence Manager¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | — |
Focus¶
- collect interval planning and drift checks
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-7/05-polling-cadence-manager
python project.py --input data/sample_input.txt --output data/output_summary.json
pytest -q
Expected terminal output¶
Expected artifacts¶
data/output_summary.json- Passing tests
- Updated
notes.md
Alter it (required)¶
- Add a
jitterparameter that adds random variation (e.g. +/- 10%) to the interval to prevent thundering herd. - Track and report the average interval across all polls in the simulation.
- Re-run script and tests — verify jitter and average interval appear in output.
Break it (required)¶
- Set
backoff_factorto 0 or negative and observe what happens to the interval. - Set
min_intervalgreater thanmax_intervaland run the simulation. - Capture the infinite loop or nonsensical interval values.
Fix it (required)¶
- Validate that
backoff_factor > 1.0andspeedup_factoris between 0 and 1. - Raise
ValueErrorifmin_interval >= max_interval. - Add tests for invalid config values and boundary conditions.
Explain it (teach-back)¶
- Why does exponential backoff reduce load on an unchanged data source?
- What happened when backoff_factor was zero?
- How did the validation prevent the runaway interval?
- Where is adaptive polling used in real monitoring systems?
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.
Mastery Check¶
- Can you explain the architectural trade-offs in your solution?
- Could you refactor this for a completely different use case?
- Can you identify at least two alternative approaches and explain why you chose yours?
- Could you debug this without print statements, using only breakpoint()?
Related Concepts¶
- Errors and Debugging
- Files and Paths
- How Imports Work
- Types and Conversions
- Quiz: Errors and Debugging
| ← Prev | Home | Next → |
|---|---|---|