Wednesday 20 February 2019

How to send data bidirectionally between an infinite running Python process and express/Nodejs

I have an node.js express app that is handling requests on the frontend dashboard for users. I need to do some computations on Python and run some tasks using Celery. After some research I found the following methods. I am feeling overwhelmed with the number of possibilities here. Would appreciate some direction...Child Process (spawns and dies when the task is over I guess)Python shell (same as above)ZeroMQ or any other similar queuing systemI could have Python store the computed values to redis and access them from express route handlerI could have Python use a tornado web server to directly serve the computed content on a different route (express has lusca not sure what Tornado offers here for CSRF, also not sure if Tornado can play nicely with Celery, the TCELERY library seems seriously outdated)I could have Flask run a separate webserver with Threads to do IO and processes to do computations and serve results directly. (Lusca XRSF no idea, though it seems Celery is good to go with this approach)I could setup a pubsub channel on redis between normal python script that runs infinitely in DAEMON mode and the express serverPhew! so many choices, I am feeling paralyzedWhat would be a decent way to do this. Can anyone share their experience on this, thanks in advance

Submitted February 21, 2019 at 05:46AM by mypirateapp

No comments:

Post a Comment