forked from mtusi2026/mtusi2026lab5
add level 4
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""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))
|
||||
Reference in New Issue
Block a user