简体   繁体   中英

Python Daemon / Interprocess Communication

I need to perform a fairly intensive computation on an image input by user. I need to load several files and external deep learning libraries for it to work which takes several seconds to load. Moreover, the idea is to get the input image from a web interface which means there are going to be of multiple requests at the same time.

I looked into daemon process and multiprocessing packages in python but am no closer to implementing even a basic framework like the following. What is the correct way to implement such requirement?

load libraries
perform pre-processing steps
wait for input from another python script 
(will eventually be a user uploaded image from web-app)
while (1)
if input received
   process input
   return result
end
end

I wanted to let everyone know that I simply used cherrypy and did all the loading and preprocessing steps before launching my server. I'm not sure if its the best way of doing it but it is working so far.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM