Notes
asyncio.run() gets the event loop, runs tasks until they're complete, and closes the event loop. Introduced in Python 3.7 and replaces asyncio.get_event_loop() and loop.run_until_complete(). E.g.
asyncio.run(main())
rather than:
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(main())
finally:
loop.close()
async.gather will schedule multiple async tasks at once. Waits for all tasks to be completed, returns list of results.
Links
Async/Await Programming Basics with Python Examples for Redis: examples of async.gather() w/ Redis API
AsyncIO in Python: A Complete Walkthrough: great overview
Asyncio PySheeet: reference snippets
https://fredrikaverpil.github.io/2017/06/20/async-and-await-with-subprocesses/
https://docs.python.org/3/library/asyncio-task.html#asyncio.gather
https://stackoverflow.com/questions/48483348/how-to-limit-concurrency-with-python-asyncio
https://docs.python.org/3/library/asyncio-sync.html#asyncio.Semaphore