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

Резултати

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

Пребарај: #yellowfever

当前筛选 #yellowfever清除筛选

#YellowFever is transmitted through the bite of an infected mosquito. If you experience any of the following symptoms: Bleeding (from the nose, ears, or mouth) ➡️Sudden fever ➡️Body pain ➡️Severe headache Report to a health care facility near you immediately

Hashtags

As with #cholera, cases of #yellowfever also increase during the rainy season. Mosquito control helps reduce the risk of #Yellowfever infection. Ensure you: ✅Get rid of stagnant water ✅Keep your environment clean ✅Keep your water containers covered properly ✅Wear protective clothing to prevent mosquito bites #TakeResponsibility

Our guidelines on Infection Prevention & Control for #ViralHemorrhagicFevers include standard operating procedures and checklists to be used in the care & management of VHFs such as #LassaFever & #YellowFever. Healthcare workers are urged to read & share via 🔗https://ncdc.gov.ng/themes/common/docs/protocols/341_1707300274.pdf

Our guidelines on Infection Prevention & Control for #ViralHemorrhagicFevers include standard operating procedures & checklists to be used in the care & management of VHFs such as #LassaFever & #YellowFever Healthcare workers are urged to read & share via https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf

#Yellow Fever is an acute viral infection spread by the bite of infected mosquitoes . The disease can cause mild illness in some, but in severe cases it may lead to life-threatening complications. 👉 Protect yourself and those around you by: ✔️ Getting vaccinated ✔️ Preventing mosquito bites ✔️ Seeking medical care if symptoms appear Together, we can eliminate the threat of Yellow Fever. 💪✨ #YellowFever#StaySafe#HealthyLiving#NCDCNigeria

12
ПретходнаСтраница 1 од 2Следна