BuildMidData / MLAuto-graded
Summarize a log file bigger than RAM
Meeting a hard memory limit requires changing the approach, not quietly approximating the answer and hoping nobody checks.analyze.py summarises an access log — total requests, error count, unique users, busiest users, p95 latency. It works on a toy file and collapses on the real one, because in production the log is larger than this machine's RAM and the code reads the whole file into memory. Its attempt to save memory makes things worse: it computes the p95 from only the first slice of the file, and latency drifts upward over time, so that sample is systematically wrong. Rewrite it to stream.30 min
python
You're done when
- The analysis runs within the memory cap instead of being killed.
- It emits valid JSON.
- The total request count is correct.
- The error count is correct.
- The unique user count is correct.
- The busiest users are identified correctly.
- The p95 latency is computed over the whole log rather than an early sample.
What it measures
ETL and data pipelinesProcessing a dataset larger than memory in a single pass, holding only bounded state.
Event-driven architectureAggregating a stream incrementally, including a percentile that cannot be computed from a prefix.
Sampling awarenessRecognising that an early slice is not a representative sample when the underlying value drifts.
Your environment
Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards
Start this lab
30 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo