feat: крролик, по тщ 5 лаба

This commit is contained in:
Enterxx2
2026-11-10 12:38:09 +03:00
parent 1d8dfb7ea4
commit 595a959b96
65 changed files with 2692 additions and 216 deletions
+3 -2
View File
@@ -174,7 +174,7 @@ def upload_once(base: str, token: str, chat_id: str, content: bytes, content_typ
except OSError as error:
return {"status": None, "error": type(error).__name__, "seconds": time.monotonic() - started}
result = {"status": status, "instance": instance, "seconds": time.monotonic() - started}
if status == 201:
if status == 202:
result["id"] = json.loads(body)["id"]
return result
@@ -218,10 +218,11 @@ def run_round(client: Client, actor: dict, chat: dict, profile: str, content: by
sampler.stop()
after = {container_name(c): process_status(c) for c in containers}
ok = [r for r in results if r.get("status") == 201]
ok = [r for r in results if r.get("status") == 202]
sample = ok[0]["id"] if ok else None
checksum_ok = None
if sample:
client.wait_ready(actor, {"id": sample})
downloaded = client.call("GET", f"/api/v1/attachments/{sample}/content", actor=actor)["bytes"]
checksum_ok = hashlib.sha256(downloaded).digest() == hashlib.sha256(content).digest()
seconds = [r["seconds"] for r in ok]