Files
felhom.eu/documentation/audits/cleanup-2026-09-23/watch.py
T
admin 210394ec6e
gates / gates (push) Successful in 26s
Clean-up evening: R-634 cause fixed, held badge, OOM storm; floor 0.265.0
R-634, R-625, R-636, R-647, R-648 closed; R-649 (operator question) and
R-650 opened. Open rows 334 -> 331. 08 §6.2 storm rung; 09 §6.4 parts
8-9 SHIPPED. Evidence: audits/cleanup-2026-09-23/.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-09-23 17:40:01 +02:00

27 lines
1.5 KiB
Python

"""Deploy one app (or none) and record every change of deployed/deploying/state with a timestamp."""
import sys, time, json
import walk as w
app = sys.argv[1]; cap = int(sys.argv[2]) if len(sys.argv) > 2 else 900
w.login()
if "--deploy" in sys.argv:
vals = w.deploy_values(app, app)
c, d = w.ctl("POST", f"/api/stacks/{app}/deploy", {"values": vals} if vals else {})
w.say(f"deploy {app} -> {c} {str(d)[:160]}")
last = None; t0 = time.time()
while time.time() - t0 < cap:
st = w.stack(app)
cur = (st.get("deployed"), st.get("deploying"), st.get("state"), st.get("deploy_error"))
if cur != last:
w.say(f"+{time.time()-t0:6.1f}s {app}: deployed={cur[0]} deploying={cur[1]} state={cur[2]} err={str(cur[3])[:200]!r}")
last = cur
if "--until-settled" in sys.argv and cur[1] is False and time.time() - t0 > 30 and cur[2] in ("running", "not_deployed", "error", "stopped", "exited"):
# settled: keep watching 60 s more for late flips
end = time.time() + 60
while time.time() < end:
st = w.stack(app); c2 = (st.get("deployed"), st.get("deploying"), st.get("state"), st.get("deploy_error"))
if c2 != last: w.say(f"+{time.time()-t0:6.1f}s {app}: deployed={c2[0]} deploying={c2[1]} state={c2[2]} err={str(c2[3])[:200]!r}"); last = c2
time.sleep(3)
break
time.sleep(3)
w.say("final:", json.dumps({k: w.stack(app).get(k) for k in ("deployed","deploying","state","deploy_error","containers")}, default=str)[:600])