Files
mtusi2026lab5/src/replay.py
T
2026-10-26 10:29:54 +03:00

25 lines
716 B
Python

"""Operator-only safe replay for a failed attachment job."""
import argparse
import asyncio
from uuid import UUID
from .config import load_settings
from .storage.postgres import PostgresStore
async def run(attachment_id: UUID) -> None:
store = PostgresStore(load_settings().database_url)
await store.connect()
try:
if not await store.replay_failed_attachment(attachment_id):
raise SystemExit("attachment is not in failed state")
finally:
await store.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("attachment_id", type=UUID)
args = parser.parse_args()
asyncio.run(run(args.attachment_id))