@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 #400 · 8 дек.
Три способа выполнить множество задач с asyncio Функция для примера: async def do_it(n): await asyncio.sleep(random.uniform(0.5, 1)) return n 1. Последовательный вызов async def main(): for i in range(100): result = await do_it(i) Такой вызов имеет смысл только тогда, когда результат одной задачи требуется для вызова следующей. Если они независимы, то это антипаттерн, так как аналогичен простому синхронному вызову по очереди. 2. Упорядоченный результат async def main(): tasks = [do_it(i) for i in range(100)] results = await asyncio.gather(*tasks) Выполняет корутины конкурентно и возвращает результат в виде списка. Полезен когда требуется получить результаты в том же порядке в котором задачи отправлены. 3. Результат по мере готовности tasks = [asyncio.create_task(do_it(i)) for i in range(100)] for cor in asyncio.as_completed(tasks): result = await cor Так же выполняет корутины конкурентно, но не гарантирует порядок. Результат возвращается по мере готовности, каждый отдельно. Полезен когда нужно обработать любой ответ как можно скорее. #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