On Tuesday 08 April 2003 11:13 am, Eddie Mönch wrote:
Hi All,
Could someone help with this problem: I have a long running process performed with an external method. Long means > 30 min. At the and I'm giving back HTML code to the calling object. What I need now is same sort of progress information on the web page (e.g. Processing step 50 out of 100). Has anyone an idea how to do this?
My suggestion would be to spawn this as an external process. Then redirect to a progress page with a meta refresh interval set. You will then have to devise some way for the page refresh to get the status from the process. One way might be for the external process to call back to the server (over XML-RPC), and set the progress value every so often (possibly the same interval as the page refresh). The server would store this in the user's session. The progress page would look in the session for the progress value and draw the progress screen appropriately. When it reached 100%, the progress page would redirect to a final "completed" page. To make this work, the original external method would need to create a random key that was passed to both the external process (on the command line) and the progress bar page (via the URL). That would be the key used to store and access the progress data in the session. If you don't care about tying up a Zope thread for 30 minutes, then you could skip spawning the external process, and just have it write its status to the session directly every so often. The progress bar page could work the same. XML-RPC in python is pretty transparent though, so it would not add that much complexity to your code to use a separate process. hth, -Casey