FlowKit icon indicating copy to clipboard operation
FlowKit copied to clipboard

Asyncio more generally

Open greenape opened this issue 5 years ago • 3 comments

So, ipython and jupyter now include a magic event loop and you can do-

async def foo():
    return 'Hi'

await foo()

And it'll just work. This raises the interesting possibility that we could move to a fully async flowclient and/or flowmachine. Both are pretty well suited - most blocking things block because they're waiting on the network. One issue when it comes to flowmachine is that sqlalchemy, which currently drives the database, is not (nor shall be anytime soon), async friendly.

This isn't any kind of immediate priority, just one to mull over really.

greenape avatar Feb 04 '20 12:02 greenape

I was thinking about this in the context of flowmachine over the weekend.

One key thing that would need to happen to allow us to make db connections fully async is to remove any communication with the db from __init__. This is something we'd danced around for a while, because it would be a good idea in general but is a bit of a fiddle.

The main reason we talk to the db during object creation is to prevent the creation of queries that will fail when run. We would, I think, want to add a preflight method that checks viability. Would also need to excise any sqlalchemy business for creating subsets.

greenape avatar Sep 28 '20 10:09 greenape

Relates to #173

greenape avatar Oct 02 '20 11:10 greenape

SQLAlchemy is now async friendly, so this is less of a stretch now.

greenape avatar Dec 10 '21 10:12 greenape