forked from mtusi2026/mtusi2026lab5
test(pipeline): record verified limits and complete cluster recovery evidence
This commit is contained in:
@@ -7,6 +7,7 @@ import multiprocessing
|
||||
import resource
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
|
||||
import redis
|
||||
@@ -122,6 +123,20 @@ def process(job_id, fence, sender):
|
||||
if not row:
|
||||
sender.send({"result": "stale"})
|
||||
return
|
||||
# Record limits before fault hooks: a slow external inspector must not
|
||||
# consume the child timeout while attempting to observe the limit.
|
||||
cgroup = Path("/sys/fs/cgroup")
|
||||
limits = {
|
||||
name: (cgroup / name).read_text().strip()
|
||||
if (cgroup / name).exists()
|
||||
else "unavailable"
|
||||
for name in ["memory.max", "cpu.max"]
|
||||
}
|
||||
limits["address_space_bytes"] = list(
|
||||
resource.getrlimit(resource.RLIMIT_AS)
|
||||
)
|
||||
with db.connection() as conn:
|
||||
event(conn, job_id, "worker_resource_limits", limits)
|
||||
fault(db, job_id, "before_effect")
|
||||
upstream = store.get(key=row["source_key"])
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user