lab5: асинхронный воркер, брокер сообщений

This commit is contained in:
2026-11-20 18:44:04 +03:00
parent 276dbdad8a
commit 35753ff11d
88 changed files with 5726 additions and 53 deletions
+29
View File
@@ -0,0 +1,29 @@
import asyncio
import sys
from uuid import UUID
from app.worker import async_session_maker, engine
from app.models.attachment import Attachment
async def main():
attachment_id = UUID(sys.argv[1])
try:
async with async_session_maker() as session:
att = await session.get(Attachment, attachment_id)
if att is None:
print("Attachment not found")
return
print("Attachment ID:", att.id)
print("Status:", att.status)
print("Error code:", att.error_code)
finally:
await engine.dispose()
if __name__ == "__main__":
asyncio.run(main())