@sgmrt · Post #2279 · 05.03.2025 г., 09:04
[CCL]: Train services have resumed to normalcy. Free regular bus services will cease between #Promenade and #Serangoon. We are sorry for affecting your commute. - 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
Пребарај: #serangoon
@sgmrt · Post #2279 · 05.03.2025 г., 09:04
[CCL]: Train services have resumed to normalcy. Free regular bus services will cease between #Promenade and #Serangoon. We are sorry for affecting your commute. - SMRT
Hashtags
@sgmrt · Post #2274 · 05.03.2025 г., 08:14
[CCL]: Please add 30 mins train travel time between #Promenade and #Serangoon, in both directions due to train fault. Free regular bus service is available between #Promenade and #Serangoon. Train service is still available. - SMRT
Hashtags
@sgmrt · Post #2181 · 14.12.2024 г., 11:14
[CCL] UPDATE: Train fault cleared. Train service between #Promenade and #Serangoon is progressively returning to normal. Free regular bus service are still available between #Promenade and #Serangoon. - SMRT
Hashtags
@sgmrt · Post #2180 · 14.12.2024 г., 11:05
[CCL] UPDATE: Please add an additional 30mins train travel time between #Promenade and #Serangoon due to a train fault. Free regular bus service are available between #Promenade and #Serangoon. - SMRT
Hashtags
@sgmrt · Post #2179 · 14.12.2024 г., 10:49
[CCL] UPDATE: Additional 30mins train travel time between #Promenade and #Serangoon due to a train fault. Free regular bus service are available between #Promenade and #Serangoon. - SMRT
Hashtags
@sgmrt · Post #1424 · 01.04.2022 г., 04:26
[CCL] CLEARED: Fault cleared, trains service progressively resuming. Free regular bus and bridging bus services between #Promenade and #Serangoon are still available. - SMRT
Hashtags
@sgmrt · Post #2352 · 20.05.2025 г., 00:44
[CCL] UPDATE: Train fault has recovered, train services are progressively resuming. Free regular bus services are still available between #Serangoon and #BuonaVista. - SMRT
Hashtags
@sgmrt · Post #2351 · 20.05.2025 г., 00:39
[CCL] UPDATE: Please continue to add 30min travel time between #PayaLebar and #BuonaVista. Free regular bus services are available between #Serangoon and #BuonaVista - SMRT
Hashtags
@sgmrt · Post #2350 · 20.05.2025 г., 00:34
[CCL]: Due to a train fault, please add 30 minutes travel time between #PayaLebar and #BuonaVista. Free regular bus services are available between #Serangoon and #BuonaVista. https://bit.ly/44HtD1b - SMRT
Hashtags
@sgmrt · Post #1422 · 01.04.2022 г., 04:09
[CCL] UPDATE: Additional 30mins train travel time between #Stadium and #Bartley due to a train fault. Free regular bus and bridging bus services between #Promenade and #Serangoon are available. - SMRT
@sgmrt · Post #1420 · 01.04.2022 г., 03:52
[CCL] Additional 20mins train travel time between #Stadium and #Bartley due to a train fault. Free regular bus services between #Promenade and #Serangoon are available. - SMRT
@sgmrt · Post #2278 · 05.03.2025 г., 08:54
[CCL]: Train services are progressively returning to normalcy. Please add 5 mins of additional travelling time between #Promenade and #Serangoon in both directions. Free regular bus services are available between #Promenade and #Serangoon. Shuttle train service will cease between #Bartley and #Mountbatten. - SMRT