2 ms·
It took me an hour to create a program that tails some logs and alerts when it doesn't receive any logs for a given amount of time. For this task I did not even
by nurettin 7y ago
It took me an hour to create a program that tails some logs and alerts when it doesn't receive any logs for a given amount of time. For this task I did not even need to leave the asyncio module. It lets you create subprocesses and execute call_later on the event loop in order to simulate a heartbeat while reading the output of tail at the same time.
Did asyncio module feel bloated? It certainly did. It seems like every module from subprocess to networking to io is crammed into it.
On the other hand, did it get the job done without resorting to any packages or threading? Yep, and that is pretty powerful and rare.
- Waterluvian 7y agoAsyncio is an amazing tool that makes me not hate doing async with Python. There was quite a learning curve with the library. A lot of Lego pieces. But I found the handful I need and then learn new ones occasionally. I think bloatedness of the stdlib isn't actually a practical problem. It's just an inelegance that you kind of have to learn to tolerate.