TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #401 · 15 дек.

Функция asyncio.wait() это еще один способ вызвать множество асинхронных задач. Она работает в нескольких режимах. 1. Самый простой - ждем завершения всех задач async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(10)] done, pending = await asyncio.wait( tasks, return_when=asyncio.ALL_COMPLETED ) for task in done: try: print(task.result()) except Exception as e: print(e) Очень похоже на gather, но работает не так. ▫️возвращает не результаты, а два сета с объектами Task у которых можно забрать результат через task.result() если они в списке done ▫️не гарантирует порядок результатов так как оба объекта это set ▫️не выбрасывает исключение когда оно появляется, а сохраняет его в Task. Исключение появится когда попробуете забрать резултьтат. 2. Ждем завершения первой задачи, даже если там ошибка. async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(3)] done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED ) # в done может быть несколько задач! for task in done: try: print(task.result()) except Exception as e: print(f"Fail: {e}") # Оставшиеся задачи в pending, как правило, нужно отменить, иначе они будут продолжать работать for task in pending: task.cancel() В сете done будут таски которые успели завершится, причем как успешно так и нет. 3. До первой ошибки. Тоже самое, но с аргументом FIRST_EXCEPTION done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_EXCEPTION ) Функция завершается как только первая задача упадет с ошибкой. Учтите, что в любом случае done вы можете обранужить несколько задач, как с ошибками так и успешные. ↗️ Полный листинг примеров здесь #async

Hashtags

Резултати

Пронајдени 2 слични објави

Пребарај: #dedipath

当前筛选 #dedipath清除筛选
VPS简测

@vps_test · Post #479 · 31.08.2023 г., 10:31

JJNEWS DediPath将要跑路(没提到洛杉矶区域,暂不清楚是否会全部跑) Dear mjj, We will are writing to you regarding your service at DediPath. With a heavy heart we must announce that DediPath will be discontinuing operations effective 8/31/23. Please migrate your data and take backups as soon as possible. In regards to our colocation customers if you are in the following locations please send a ticket to [email protected] for equipment removal: Dallas Las Vegas Denver Atlanta Jacksonville In regards to our colocation customers if you are in the following location please send a ticket to [email protected] for equipment removal: Seattle In regards to our colocation customers if you are in the following locations please send a ticket to [email protected] for equipment removal: Phoenix In regards to our colocation customers if you are in the following locations please send a ticket to [email protected] for equipment removal: Secaucus Redondo Beach San Jose If you have a domain registered with us please transfer it out ASAP. We are truly sorry for the inconvenience this has caused. We appreciate your business and support over the years and this is heart breaking to everyone at DediPath. Sincerely, DediPath #jjnews#dedipath

VPS简测

@vps_test · Post #131 · 07.06.2023 г., 02:58

DediPath Hybrid Server(高性能不超售服务器)原价11.4刀,官方5折->5.7刀 2C4G250G HDD 意外的是流媒体解锁,G口真不限流量!适合建站,中国移动部分省份用不了(比如江苏) #dedipath#1Gbps#不限流量#流媒体解锁