Files
felhom.eu/documentation/audits/sizing-check-2026-10-14/tools/hp_figures.py
T

33 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""hp_figures.py — the HP t740 check's per-app figures (CHECK.md), as one file: ../hp-figures.json.
Basis: `used` = memory.current - inactive_file, summed over an app's containers (the sizing run's definition).
R1 (evidence/R1-set/set-summary.json, 9201, full memory): typical = the median in rest B (01:08:40-01:29:30 UTC),
peak = the highest `used` over the whole run (the three heavy apps' import/transcode/upload included).
R4 (evidence/R4-b1..b4/summary.json, 9202, full memory, light batches): typical = mem_rest_avg_mb,
peak = mem_peak_used_mb (a start-up peak only — no action).
Only the apps CHECK.md compares with the page. R3 (the 4 GB guest) is NOT a source: its figures are memory pressure.
Run: python3 -I tools/hp_figures.py
"""
import json, os
HERE = os.path.dirname(os.path.abspath(__file__)); AUD = os.path.dirname(HERE); EV = os.path.join(AUD, "evidence")
R1_APPS = ["immich", "jellyfin", "nextcloud", "home-assistant", "vaultwarden", "paperless-ngx",
"bookstack", "calibre-web", "kimai", "privatebin", "bentopdf"]
out = {}
s = json.load(open(os.path.join(EV, "R1-set", "set-summary.json")))
for a in R1_APPS:
o = s["apps"][a]
out[a] = dict(typical_mb=o["restB_median_mb"], peak_mb=o["peak_used_mb"], box="demo-hp (HP t740)",
run="R1-set", cite="audits/sizing-check-2026-10-14/evidence/R1-set/set-summary.json")
for b in (1, 2, 3, 4):
s = json.load(open(os.path.join(EV, f"R4-b{b}", "summary.json")))
evs = json.load(open(os.path.join(EV, f"R4-b{b}", "events.json")))
deployed = {e["app"] for e in evs if e["kind"] == "deploy_done"}
for a, o in s["apps"].items():
if a in deployed and o.get("rest_samples"):
out[a] = dict(typical_mb=o["mem_rest_avg_mb"], peak_mb=o["mem_peak_used_mb"], box="demo-hp (HP t740)",
run=f"R4-b{b}", cite=f"audits/sizing-check-2026-10-14/evidence/R4-b{b}/summary.json")
json.dump(dict(date="2026-10-14", basis="used = memory.current - inactive_file", apps=out),
open(os.path.join(AUD, "hp-figures.json"), "w"), indent=1)
print(len(out), "apps")