Sharing python objects across multiple workers
We have created a service using FastAPI. When our service starts it creates a few python objects that the endpoints then use to store or retrieve data from.
We have created a service using FastAPI. When our service starts it creates a few python objects that the endpoints then use to store or retrieve data from.
I’ve read many examples, blog posts, questions/answers about asyncio / async / await in Python 3.5+, many were complex, the simplest I found was probably this one.
Still it uses ensure_future, and for learning purposes about asynchronous programming in Python, I would like to see an even more minimal example, and what are the minimal tools necessary to do a basic async / await example.
I have some asyncio code which runs fine in the Python interpreter (CPython 3.6.2). I would now like to run this inside a Jupyter notebook with an IPython kernel.
In asynchronous JavaScript, it is easy to run tasks in parallel and wait for all of them to complete using Promise.all: