Pregunta

I have made this python (2.7) program that takes a few hours to complete, looping through stuff all the time. I also have a windows 2008 server which I want to use to run this program, I can run it just fine on its own and leave it alone for a while, but I want to use a web interface to achieve the same effect.

I currently use cherrypy and made a form that submits to another page and executes the code there, which works somewhat, but when I close the browser the execution stops. What I really want to do is create a form that provides a function with some arguments and start a standalone python script from there, and possibly also include a stop button to stop the execution. Is this in any way possible?

¿Fue útil?

Solución

Yes, this is possible. However, you need to decouple execution of your programme from your web interface.

Probably the simplest setup is to use supervisor to run both your program and your web interface. How your program and your web interface interact is up to you. You could even have your web interface control supervisor, or see if there is a third party web interface for supervisor.

Otros consejos

I'm sure it's completely possible, there are numerous modules for Python that act task queue/job queue managers. The first that comes to my mind is Celery.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top