extremeheat / JSPyBridge

🌉. Bridge to interoperate Node.js and Python
MIT License
659 stars 47 forks source link

Multiple concurrent python calls #93

Open ashot opened 12 months ago

ashot commented 12 months ago

Does the bridge support multiple concurrent calls to python without blocking? For example in the context of a server?

It seems the current behavior is to block and wait for each call to complete serially. Is it possible to do, if not is there a workaround?

Thanks for the great library!

ikb42 commented 9 months ago

Hi @ashot did you get any further with this?

extremeheat commented 9 months ago

It depends if the Python call is blocking the main thread or not. If it is, then yes no further calls can be done on that thread. Otherwise yes, if it's asynchronous in that there is a callback invokes after queueing a job in async or threading, then other calls to python can be made concurrently.

ashot commented 9 months ago

Hi @ashot did you get any further with this?

This library is not the right solution if you need multiple async calls. I ended up running a flask process and writing a simple bridge back and forth via http, you can also setup thrift or protocol buffers if you want typing.