These are chat archives for cherrypy/cherrypy

5th
Aug 2018
Colin Dente
@colindente_twitter
Aug 05 2018 15:01

I have read through the documentation, and searched for examples until my head aches, but I can't find the answer to this question: I would like to control an embedded application using cherrypy as a front end.

At the simplest level, the app will present two buttons "start" and "stop". Pressing "start" will start some (reasonably cpu-intensive) python code running, and the idea is that it should keep running until "stop" is pressed. I have looked at running the code as a BackgroundTask, but don't see how I can communicate the "stop" command to that, and I have looked at using the bus . The code that is running can pause every now and then to check for messages, but I'm not sure whether this can be supported through the engine or whether I need to build my own wspbus to handle this sort of messaging.

Any pointers would be hugely appreciated.

Colin Dente
@colindente_twitter
Aug 05 2018 19:02
I've kinda solved the problem using multiprocessing and posing a queue to the constructor of the class that defines my cherrypy app, but if still be interested to know if anyone has an idea for a more elegant solution