[Zope] how do I manage a graceful shutdown?

Jamie Heilman jamie@audible.transient.net
Fri, 21 Feb 2003 01:31:50 -0800


Toby Dickenson wrote:
> On Thursday 20 February 2003 9:48 pm, Jamie Heilman wrote:
> > OK, so if one had a Product that they wanted to be lifetime aware, do
> > you have an example of how one could one use this API?
> 
> I hope youve read the documentation in Lifetime.py.

I had, and thats why I asked, because I didn't understand how a
product, that has nothing to do with socket handling, was supposed to
gain awareness from this API.  When I said:

> > and I guess, even if it was, it doesn't look like it offers much
> > in the way of hooks for products to play with.

And you replied with:

> Read the code. It allows medusa-registered sockets to manage the
> shutdown process.

I interpretted this to imply that I was wrong, that the CleanShutdown
code did provide a generic product hook.  I mentioned CleanShutdown
because Lifetime.py struck me as a logical place to provide something
like Tim is looking for.

Its been my opinion for some time that Zope could benefit from an
internal "init(8)-style" API that products could hook into.  With the
introduction of Lifetime.py and the CleanShutdown proposal it looked
like perhaps such a framework could have a home, though upon futher
inspection it looks like Lifetime.py is designed to only be concerned
with the lifetime of asyncore, and not of Zope & the ZODB in general.

Thus, in short Tim, no, there doesn't appear to be a simple solution
to your problem, unless your "products" happen to be socket handlers
or the atexit module's semantics don't bother you.

-- 
Jamie Heilman                   http://audible.transient.net/~jamie/
"...thats the metaphorical equivalent of flopping your wedding tackle 
 into a lion's mouth and flicking his lovespuds with a wet towel, pure 
 insanity..."						-Rimmer