Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11.
Ключевые отличия
▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля
▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста
▫️ошибка автоматически отменяет незавершенные задачи,
▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно
import asyncio
import random
async def do_it() -> str:
if random.random() < 0.1:
raise ValueError('Oops')
delay = random.uniform(0.5, 1.5)
await asyncio.sleep(delay)
return delay
async def main():
try:
async with asyncio.TaskGroup() as tg:
for _ in range(10):
tasks.append(tg.create_task(do_it()))
for t in tasks:
print(t.result())
except *ValueError as e:
for err in e.exceptions:
print(err)
asyncio.run(main())
Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов
- таймауты
- отмена задач
- создание задач из другого потока
#async
I Built a Mesh Network Across the World | Data Slayer
That escalated quickly...
In my last video, I introduced #Reticulum—an open-source protocol that could allow anyone to build networks without relying on traditional internet infrastructure. But there was one big question left unanswered: how far can it actually go?
In this video, I start with a simple setup inside my house and begin pushing the limits—testing communication across rooms, neighborhoods, and beyond using WiFi HaLow and #mesh networking. The goal is simple: see if it’s possible to send real messages across distance without depending on ISPs, centralized servers, or the internet as we know it.
#Network#MeshNetwork
The Internet, Reinvented.
In this video, I build a #Reticulum#RNode and prove that completely different radios — #LoRa and Wi-Fi — can communicate through a hardware-agnostic networking stack. Reticulum routes traffic above the radio layer, automatically bridging dissimilar frequencies, interfaces, and modulation types. I then run it over Wi-Fi HaLow Haven nodes to create a long-range, encrypted IP #mesh with no traditional infrastructure.
Finally, I push it further by running #ATAK across the network, demonstrating a fully open-source, decentralized communication stack in action.
Checkout https://rmap.world/
You can install rnode software on your esp32/nrf52 based meshtastic/meshcore hardware