I have a third party library (in this case azure-cosmos) that is performing slow blocking operations. I'd like to use this with the asyncio library to leverage a degree of parallelism where I can start up another request as one is waiting for us data.
I've looked around online but been unable to find a concrete answer as to how to perform this wrapping of the external library; is it as easy as:
def external_sync_method(*args, **kwargs):
...
async def my_async_code():
args_list = [...]
return await asyncio.gather(*(external_sync_method(*args) for args in args_list))