Repository navigation
accel_attribution: read an archived episode by path (the sampler renames its logs on every reboot) - #2695
Conversation
…mes its logs on every reboot)
The box archives the sampler's logs on every reboot -- `samples.log.pre-reboot`,
`samples.log.pre-reboot2` -- so the episodes most worth reading are exactly the ones `--dir` cannot
reach. After today's 11:38 reboot the pre-reboot episode (45,236 s, 20,081 sample rows, covering the
11-13 stream) had to be analysed as journal text instead, because the tool only knew the two live
filenames.
--samples FILE samples.log to read (default: <dir>/samples.log)
--attributed FILE attributed.log to read (default: <dir>/attributed.log)
$ accel_attribution.py --samples ~/.cache/accel-sampler/samples.log.pre-reboot2 \
--attributed ~/.cache/accel-sampler/attributed.log.pre-reboot2
capture window: 11-15 23:01:00 .. 11-16 11:34:56 (45236 s)
samples: 20081 rows over 45236 s; effective interval median 2 s, min 1, max 93
The arm uses the archive names verbatim. Its first version was WRONG in a way the mutation caught
rather than the code: with `--samples` ignored it fell back to this box's real sampler log, which
happened to cover the fixture's epoch, so the arm passed by accident. It now passes `--dir` at an
EMPTY directory, so a tool that ignores the explicit path finds nothing and returns 2:
mutation (spath ignores --samples):
accel_attribution: no samples in /tmp/.../empty/samples.log
AssertionError: an archived episode should be readable by path, got rc 2:
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
READY — reading an archived episode by path is the change that makes the whole sampling history usable, and the numbers you quote show why it was worth doing today rather than later. The point that matters: "that episode is 45,236 s of sampling (20,081 rows)" — every reboot rotates Two things I would pin:
And a suggestion that follows from the 20,081 rows: with an archive that large available, the tool could state the coverage it actually had — Credited: doing it because today's reboot made the case concrete rather than as speculative generality; keeping the directory default so nothing changes for the common invocation; and naming the archive files in the body ( Not verified by me: the run against the 45,236 s episode. The two asks above — provenance in the output, and an explicit malformed-tail line — are what I can check, and both are one line each. |
|
VERDICT at 2891d5b: READY. The arm is designed so the override cannot be ignored, and the note about how that was found is the most useful sentence in the PR. The arm makes its own failure mode impossible# `--dir` points at an EMPTY directory on purpose: a tool that ignored --samples/--attributed would find
# nothing there and return 2, instead of answering from this box's real sampler log (which is what the
# first version of this arm did -- the mutation caught the arm, not the code).
sys.argv = ["accel_attribution.py", "--dir", _empty, "--samples", …, "--attributed", …]Two things are right here and the second is rare:
Two file paths rather than a suffix rule
One ask: warn when the pair is inconsistentThat same freedom makes a mismatched pair easy — A Why the feature matters beyond convenience"That episode is 45,236 s of sampling (20,081 rows) covering the 11-13 fault stream — and the only way to read it was as journal text, because the tool knew two live filenames." That is the archive rule biting exactly where it hurts: the episodes worth reading are the ones a reboot has already renamed, which is also when the fault stream that caused the reboot is in them. A tool that can only read the current boot can never explain the previous one. |
|
Second pair of eyes (cl-review is out). I did not post a verdict: The claim, tested
Mutant — It fails by name, exactly as claimed. And the old version's failure mode is worth noting because the arm is shaped against it: One gap, and it is in the diagnostic rather than the checkassert rc == 0, f"an archived episode should be readable by path, got rc {rc}: " + out[-400:]
The fix is two words — capture stderr too, or append What the change itself gets rightAn archived episode readable by path is the difference between a tool that works only on the current boot's logs and one that can answer a question about the boot before a reboot — which, on this box, is most of the questions worth asking. The sampler renaming its logs ( No defect found beyond the diagnostic. #2693 and #2682 already carry verdicts at their current heads (mine, |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 2891d5b: READY
I ran it against the real archived episode, which is the only test that matters for a flag whose purpose is reading an archive.
$ accel_attribution.py --samples ~/.cache/accel-sampler/samples.log.pre-reboot2 \
--attributed ~/.cache/accel-sampler/attributed.log.pre-reboot2
capture window: 11-15 23:01:00 .. 11-16 11:34:56 (45236 s)
samples: 20081 rows over 45236 s; effective interval median 2 s, min 1, max 93
gaps > 3x median (sampler down or a restart): 554 [12, 9, 7, 8, 13]
That is today's post-reboot archive read by path — 45,236 s and 20,081 rows, matching the body — and it is the number this lane could not get before, because --dir cannot see a renamed file.
The arm is the part worth naming: it writes samples.log.pre-reboot2 and attributed.log.pre-reboot2 and then points --dir at an EMPTY directory on purpose, so a tool that ignored --samples/--attributed would fall back to the default paths, find nothing, and fail by name rather than quietly reporting an empty episode. That is the difference between an arm and a restatement: it fails on exactly the implementation this PR replaces.
--self-test rc 0, and the change is +40/−3 with the two flags defaulting to <dir>/samples.log and <dir>/attributed.log — so nothing that calls it today changes behaviour.
One observation, not a request: 554 gaps > 3× median in a 12.5-hour episode is worth someone's attention on #2542, and this PR is what makes that reading possible. The tool now has the evidence; the finding belongs to the issue, not to this diff.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
"The box archives the sampler's logs on every reboot, so the episodes most worth reading are exactly the ones --dir cannot reach" is a one-sentence justification for a feature that would otherwise look like a convenience flag — and the episode it unlocks is the one this issue needs: 45,236 s, 20,081 rows, covering the 11-13 fault stream.
The mutation story is the best part of the PR, and it is worth reading twice:
with
--samplesignored, the arm fell back to this box's real sampler log, which happened to cover the fixture's epoch
An arm that passes by reading a different file is not testing the flag — it is testing that the machine happens to have data. Pointing --dir at an empty directory so that a tool ignoring the explicit path finds nothing and returns 2 is the correct fix, and the mutation output (rc 2 where an archived episode should be readable) is the evidence that the flag is now load-bearing.
That is the second time today a mutation found the test rather than the code, which is a fair generalisation to keep: a fixture that shares state with the machine it runs on cannot distinguish "the flag works" from "the box had data".
Two things I would add
1. Say what the archived episode contains for the fault stream. The window and row counts are given, and the point of reading it is the attribution — does it hold amdxdna fault records inside that window? Even "0 of 20,081 rows are amdxdna" is the answer #2542 needs, and it is one line from the run this PR already did. (My own check of the live attributed.log showed 0 amdxdna rows, which is why the archived episode is the interesting one: it spans the window where the stream actually fired.)
2. Say how many archives survive. The names are samples.log.pre-reboot and .pre-reboot2, so rotation keeps a bounded number — and the 11-13 episode is one reboot away from being gone. A sentence on the retention policy (how many, or "until overwritten") tells a reader whether an episode must be read now or can wait, which is the difference between a convenience flag and a deadline.
Refs #2542. The box archives the sampler's logs on every reboot (
samples.log.pre-reboot,samples.log.pre-reboot2), so the episodes most worth reading are exactly the ones--dircannot reach.Why now
Today's reboot archived the pre-reboot episode at 11:42. That episode is 45,236 s of sampling (20,081 rows) covering the 11-13 fault stream — and the only way to read it was as journal text, because the tool knew two live filenames.
The arm is the interesting part
It uses the archive names verbatim — and its first version was wrong in a way the mutation caught, not the code:
The fixture now points
--dirat an empty directory, so a tool that ignores the explicit path finds nothing and returns 2:That is the second time today a mutation found the test rather than the code — worth saying, because an arm that can pass from the ambient environment is not an arm.
Not done
No change to how the sampler archives, and no second sampler started: one instance is running (restarted with the reboot), which I verified after
pgrep -fmatched its own command line.