@djangoproject · Post #332 · 05.05.2017 г., 19:16
https://dbader.org/blog/queues-in-python How to implement a FIFO #queue data structure in Python using only built-in data types and classes from the standard library.
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #402 · 22 дек.
Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11. Ключевые отличия ▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля ▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста ▫️ошибка автоматически отменяет незавершенные задачи, ▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно import asyncio import random async def do_it() -> str: if random.random() < 0.1: raise ValueError('Oops') delay = random.uniform(0.5, 1.5) await asyncio.sleep(delay) return delay async def main(): try: async with asyncio.TaskGroup() as tg: for _ in range(10): tasks.append(tg.create_task(do_it())) for t in tasks: print(t.result()) except *ValueError as e: for err in e.exceptions: print(err) asyncio.run(main()) Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов - таймауты - отмена задач - создание задач из другого потока #async
Hashtags
Пребарај: #queue
@djangoproject · Post #332 · 05.05.2017 г., 19:16
https://dbader.org/blog/queues-in-python How to implement a FIFO #queue data structure in Python using only built-in data types and classes from the standard library.
Hashtags
@djangoproject · Post #455 · 03.10.2017 г., 16:39
https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/ Asynchronous Tasks With #Django and #Celery “Celery is an asynchronous task queue/job #queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well.” For this post, we will focus on the scheduling feature to periodically run a job/task.
@djangoproject · Post #585 · 23.03.2018 г., 02:43
https://www.fullstackpython.com/celery.html #Celery is a task #queue implementation for Python web applications used to #asynchronously execute work outside the HTTP request-response cycle.
Hashtags
@voir_yeux · Post #12160 · 19.03.2026 г., 11:59
🇬🇪 Des centaines de Géorgiens font la queue pour entrer dans la cathédrale de la Sainte-Trinité de Tbilissi, où se tient la messe de requiem en l'honneur du patriarche Élie II de Géorgie. #géorgie#queue#cathédrale#patriarche
@djangoproject · Post #119 · 10.08.2016 г., 14:37
18.5.8. Queues Queues: #Queue #PriorityQueue #LifoQueue #asyncio queue #API was designed to be close to classes of the queue module (Queue, PriorityQueue, LifoQueue), but it has no timeout parameter. The asyncio.wait_for() function can be used to cancel a task after a timeout. https://docs.python.org/3/library/asyncio-queue.html