简体   繁体   English

Python守护程序/进程间通信

[英]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. 此外,该想法是从Web界面获取输入图像,这意味着将同时存在多个请求。

I looked into daemon process and multiprocessing packages in python but am no closer to implementing even a basic framework like the following. 我研究了python中的守护进程和多处理程序包,但距离实现以下基本框架还差得远。 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. 我想让所有人都知道,我只是使用cherrypy并在启动服务器之前完成了所有加载和预处理步骤。 I'm not sure if its the best way of doing it but it is working so far. 我不确定这是否是最好的方法,但到目前为止它是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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