feat: add job outbox, relay, leases and image variants to the pipeline

Move publishing out of the upload path: a relay process publishes queued
jobs with confirms. Add lease and attempt fencing, backoff with jitter, a
per-job render process with CPU and memory limits, crop and optimized
variants, the failed registry with audited replay, and staging cleanup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 15:36:15 +03:00
co-authored by Claude Opus 5.5
parent 99a222eee2
commit e2a6427c24
102 changed files with 9499 additions and 1916 deletions
+8 -13
View File
@@ -379,8 +379,7 @@ def run_row(
из-за памяти (`OOMKilled` контейнера или `oom_kill` cgroup),
`host_swap` — хост выгружал страницы в swap во время прогона,
`peak_sampled` — пик окна по выборкам, а не по сброшенному
`memory.peak`, `s3_down` и `broker_down` — S3 или брокер не дожил до
конца прогона."""
`memory.peak`, `s3_down` — S3 не дожил до конца прогона."""
app = peaks.roles.get("api", Peak())
s3 = peaks.roles.get("s3", Peak())
lb = peaks.roles.get("haproxy", Peak())
@@ -394,8 +393,6 @@ def run_row(
flags.append("peak_sampled")
if state.get("s3_down"):
flags.append("s3_down")
if state.get("broker_down"):
flags.append("broker_down")
return {
**{key: run[key] for key in ("run", "variant", "size", "clients")},
"repeat": run["repeat"],
@@ -691,10 +688,9 @@ def render_summary(meta: dict[str, Any], rows: list[dict[str, Any]]) -> str:
),
f"- Реплика {profile['cpus']} CPU / {profile['memory']} без swap, "
f"буфер приёма `{meta.get('stand', {}).get('api_tcp_rmem', '—')}`; "
f"S3 {profile['s3_cpus']} CPU / {profile['s3_memory']}; брокер "
f"{profile['broker_cpus']} CPU / {profile['broker_memory']}; LB "
f"{profile['lb_cpus']} CPU / {profile['lb_memory']}. Worker не "
"запущен: задания ждут в очереди, на прогон — новый volume брокера",
f"S3 {profile['s3_cpus']} CPU / {profile['s3_memory']}; LB "
f"{profile['lb_cpus']} CPU / {profile['lb_memory']}. Обработка не "
"запущена: задания ждут в PostgreSQL",
"- Код успеха: "
+ (
", ".join(
@@ -1027,8 +1023,8 @@ def selftest() -> int:
expect("row fields", set(RUN_FIELDS) >= set(row), True)
expect("row peak", row["peak_mib"], 145.0)
expect("row success code", row["success_code"], 201)
downed = run_row(run, 1, parsed, stats, {"broker_down": True}, 0)
expect("row broker_down", downed["flags"], "broker_down")
downed = run_row(run, 1, parsed, stats, {"s3_down": True}, 0)
expect("row s3_down", downed["flags"], "s3_down")
def synth(variant: str, clients: int, peak: float, **extra: Any) -> dict:
base = {
@@ -1095,8 +1091,6 @@ def selftest() -> int:
"memory": "512m",
"s3_cpus": "1",
"s3_memory": "512m",
"broker_cpus": "1",
"broker_memory": "512m",
"lb_cpus": "1",
"lb_memory": "256m",
},
@@ -1113,7 +1107,8 @@ def selftest() -> int:
False,
)
expect("summary names code", "«с лимитом» — 202" in text, True)
expect("summary names broker", "брокер 1 CPU / 512m" in text, True)
expect("summary has no broker", "брокер" in text.lower(), False)
expect("summary jobs wait", "задания ждут в PostgreSQL" in text, True)
expect("summary has cells", "| с лимитом | 10MiB | 40 |" in text, True)
expect(
"replica growth over C=10",