@sgmrt · Post #1882 · 08.02.2024 г., 01:39
[CCL] UPDATE: Due to a signal fault, please continue to add additional 10 minutes travel time between #Stadium and #PayaLebar. You may consider alternative means of transport. - SMRT
Hashtags
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
Пребарај: #stadium
@sgmrt · Post #1882 · 08.02.2024 г., 01:39
[CCL] UPDATE: Due to a signal fault, please continue to add additional 10 minutes travel time between #Stadium and #PayaLebar. You may consider alternative means of transport. - SMRT
Hashtags
@sgmrt · Post #1881 · 08.02.2024 г., 01:14
[CCL]: Update: Due to a signal fault, please continue to add additional 10 minutes travel time between #Stadium and #PayaLebar - SMRT
Hashtags
@sgmrt · Post #1880 · 08.02.2024 г., 00:49
[CCL]: Update: Due to a signal fault, please add additional 10 minutes travel time between #Stadium and #PayaLebar. - SMRT
Hashtags
@sgmrt · Post #1879 · 08.02.2024 г., 00:05
[CCL]: Due to a signal fault, please add additional 10 minutes travel time between #Stadium and #PayaLebar. - SMRT
Hashtags
@sgmrt · Post #1425 · 01.04.2022 г., 04:41
[CCL] CLEARED: Train services between #Stadium and #Bartley have resumed. Free regular bus & free bridging bus svcs have ended. - SMRT
@sgmrt · Post #1421 · 01.04.2022 г., 04:09
[CCL]: Shuttle train service is available between #Stadium and #Bartley Platform B. - SMRT
@sgmrt · Post #1832 · 29.09.2023 г., 11:40
[CCL] CLEARED: Train services between #DhobyGhaut /#MarinaBay and #Stadium have resumed. Free regular bus and bridging bus services have ended. - SMRT
Hashtags
@sgmrt · Post #1792 · 29.09.2023 г., 00:00
[CCL] UPDATE: Our engineers are still rectifying the fault. Please add 30 mins train travel time between #DhobyGhaut / #MarinaBay and #Stadium. - SMRT
Hashtags
@sgmrt · Post #1789 · 28.09.2023 г., 23:00
[CCL] UPDATE: Our engineers are still rectifying the fault. Please add 30 minutes travelling time between #DhobyGhaut / #MarinaBay and #Stadium. - SMRT
Hashtags
@sgmrt · Post #1786 · 28.09.2023 г., 22:10
[CCL] UPDATE: Our engineers are still rectifying the fault. Please add 30 minutes train travel time between #DhobyGhaut / #MarinaBay and #Stadium. - SMRT
Hashtags
@sgmrt · Post #1693 · 07.04.2023 г., 07:02
[CCL]: Pls add 40mins of train travel time between #DhobyGhaut/#MarinaBay and #Stadium. Our engineers are on site to conduct the recovery operations. Free regular bus and free bridging bus svcs are available. - SMRT
Hashtags
@sgmrt · Post #1785 · 28.09.2023 г., 21:54
[CCL] UPDATE: Passengers travelling on CCL between #DhobyGhaut/ #MarinaBay and #Stadium, are advised to transfer to EWL at #PayaLebar to continue the journey. - SMRT