[Zope] Progress information for long running process

Casey Duncan casey@zope.com
Tue, 8 Apr 2003 16:09:10 -0400


On Tuesday 08 April 2003 11:13 am, Eddie M=F6nch wrote:
> Hi All,
>=20
> 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?=20

My suggestion would be to spawn this as an external process. Then redirec=
t to=20
a progress page with a meta refresh interval set. You will then have to=20
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 (ove=
r=20
XML-RPC), and set the progress value every so often (possibly the same=20
interval as the page refresh). The server would store this in the user's=20
session.

The progress page would look in the session for the progress value and dr=
aw=20
the progress screen appropriately. When it reached 100%, the progress pag=
e=20
would redirect to a final "completed" page.

To make this work, the original external method would need to create a ra=
ndom=20
key that was passed to both the external process (on the command line) an=
d=20
the progress bar page (via the URL). That would be the key used to store =
and=20
access the progress data in the session.

If you don't care about tying up a Zope thread for 30 minutes, then you c=
ould=20
skip spawning the external process, and just have it write its status to =
the=20
session directly every so often. The progress bar page could work the sam=
e.=20
XML-RPC in python is pretty transparent though, so it would not add that =
much=20
complexity to your code to use a separate process.

hth,

-Casey