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:
@@ -1,6 +1,7 @@
|
||||
"""Проверка ответов по `contracts/openapi.json` и форматам контракта."""
|
||||
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
import re
|
||||
from collections.abc import Iterable, Mapping
|
||||
@@ -237,6 +238,27 @@ def assert_content(
|
||||
)
|
||||
|
||||
|
||||
def assert_variant_image(
|
||||
data: bytes,
|
||||
variant: Mapping[str, Any],
|
||||
) -> object:
|
||||
"""Байты варианта — настоящее изображение своего типа и размера: JPEG у
|
||||
`thumbnail` и `crop`, WebP у `optimized`. Возвращает открытое изображение."""
|
||||
from PIL import Image # noqa: PLC0415 — декодер только для проверки
|
||||
|
||||
expected = {"image/jpeg": "JPEG", "image/webp": "WEBP"}[
|
||||
variant["content_type"]
|
||||
]
|
||||
image = Image.open(io.BytesIO(data))
|
||||
image.load()
|
||||
assert image.format == expected, (variant["name"], image.format)
|
||||
assert image.size == (variant["width"], variant["height"]), (
|
||||
variant["name"],
|
||||
image.size,
|
||||
)
|
||||
return image
|
||||
|
||||
|
||||
def assert_variant_content(
|
||||
resp: httpx.Response,
|
||||
variant: Mapping[str, Any],
|
||||
|
||||
Reference in New Issue
Block a user