Функция 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
How to not hold on to the belongings
Whilst you bathe in the agony and I am out there revolting
We see the stars with tears in our eyes and we know there's no dream left
But we do still be hopelessly waiting for the hope in disguise
There's so much patience in us but we no more could put up with the dread in our minds
Halfway through the day we yet keep awaiting for the nights
We have gotten nowhere but look how far have come our lives
From finding the purpose of our souls
to now laying down helplessly with inconsequential smiles
Only you and I know how to convey the inconveniency of the bothersome hearts with APHASIA
Expressing themselves with insufficient words and futile rhymes
#review
#sans
For courage is letting go of the fears that you reside in
and hope of a being
Gasp until your heart aches for the warmth of the love it once shared
Bawl to the agony of tragedy that flowed along with the blood through your veins
Fall into the symphony Edvard Grieg once made
Reach to the point of disgust and bathe in the trauma that surrendered to you its faith
Exist in seventeen out of hundred of your fears
For once, look closer into the mirror that is as real as it appears
Leer at The Starry Night, no Vincent could ever paint
Until your eyelids close to their suspense
Oath to the pores that your skin ever veiled
Behold the scars of your mother that never healed
Go slow in the heads of horror
Go deep in the dark philosophy in Arthur Schopenhauer’s honor
Plead to the lord of misery, for great sufferings of ever beyond and more
Wear the wisdom of the evil that history never wore
And then,
Let shadows of your beloved that long ago were burnt, sing you the last lullaby
Sleep to never wake up again in the dream of demons, ode them the last goodbye
Gather fragments of the courage you swore upon midst the million sufferings
Open the doors once latched, let bright of your brain lit the horizon of infinite dreams
#sans
#review
We have fought a battle, a long long ago.
We might have won, but in pale yellow burnt scripts, there isn't any Trace,
Though we believe, we utterly, dearly keep Faith
In it's victory, and for it did win for our fate.
I remember them saying,
'Through it's virtue God brought us Morals.
And to continue we shall act upon our deeds, correct what one feels.'
Never really did they emphasized on Ethics,
As in pale yellow burnt scripts they might have found some invisible trace's of ink.
And it might have said to them,
' Through what you believe, comes enactment of your deed, here's a path, don't bend,walk straight, here are rules, don't break, walk straight'
And onwards and ahead,
With God's sheer-sheer Grace, we
Shall keep moving.
As it says
For them, Their God,
Is pale yellow scripts.
For me Mine somewhere else exists
And when from afar afar,
I ask him to take me away,
He then silently maybe replies,
In pale yellow burns, you carve me
And then, just then,
To you ,in their invisible Traces, might seem my smiles
Until then,
Believe them.
Walk straight, don't bend,
Here is your path keep on the chase.
#review
#sans
#poetry
We pave our way towards the stardust,
When million collisions fade beside
Our labour but a mere phenomenon
to harbour where the bondsmen reside
With weapons in our brain
and shield in the sleeves
When least of the mankind
Shrink upon our feets
We then in chorus sing our defeat, with cold in the blood till ,
we March towards the heat
and
Then on the arid land
When we lay down the dead bones
It rains through our sullen sights
to the point we drown into our own build heights
We then again
Pave our way towards the stardust
When million collisions fade beside
When million collisions fade beside
#review
#poetry
#sans
We pave our way towards the stardust,
When million collisions fade beside
Our labour but a mere phenomenon
to harbour where the bondsmen reside
With weapons in our brain
and shield in the sleeves
When least of the mankind
Shrink upon our weak feets
We then in chorus sing our defeat, with cold in the blood till
We March towards the heat
and
Then on the arid land
When we lay down the dead bones
It rains through our sullen sights
to the point we drown into our own built heights
We then again
Pave our way towards the stardust
When million collisions fade beside
When million collisions fade beside
#poetry
#review
#sans
谷歌开源 Google Sans Flex 字体,可用于商业用途
谷歌已开源 Google Sans Flex 字体,用户可在 Google Fonts 平台免费下载使用,包括商业用途。该字体拥有 9 种变种,涵盖 Thin 100-Black 900 粗细范围,允许更改字重、宽度、粗细、光学大小和笔画圆角等参数。字体支持英语、法语、德语等多种拉丁语形式,但不含中文。Google Sans Flex 字体采用 SIL Open Font License 1.1 标准开源,允许免费使用、研究、修改和重新分发。IT之家
🏷#Google#Sans#Flex#开源#字体
📢 频道 👥 群组 📝 投稿
Alla ricerca di un qui ed un ora dalla forma conveniente per quanto ridotta all'osso.
#vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#testaccio#mattatoio#videogioco#videogame#undertale#undertalesans#sans