Open axshen opened 2 days ago
Skaha manages concurrency underneath the hood for you. If you call skaha.session.Session.create
with argument replicas=64
, it will launch 64 containers in parallel for you.
But you are correct, if you run skaha
from within an asyncio
loop, it fetches the existing loop to thread under, which causes the issue you see. I had not really considered the case when the user was already in a asyncio loop, e.g. JupyterLab
. I will release a fix for this issue soon.
I am writing some async code to wrap the skaha sessions into a job function so that I can concurrently generate containers. Here is a simplified example of the code I am trying to run
When I try and run my code, I get a
RuntimeError: This event loop is already running
. I read this stack overflow post which suggests you can't useloop.run_until_complete
inside of another event loop. They also suggest a hack for getting it working withnest_asyncio
, which I guess is fine and something I can try.Do you have other ideas or potential fixes for this so that it can work inside of async code?
Here is the relevant snippet from the error logs:
Software/OS: