[Twisted-Python] One big smile ...

Abe Fettig abe at fettig.net
Mon Jul 14 20:33:44 MDT 2003


On Sat, 2003-07-12 at 19:05, Moshe Zadka wrote:
> Note that your service has a bug if .startService() is called
> twice without an intervening stopService(), and you present
> here for users an ability to tickle that bug. You can probably
> work around in many ways...
> 
> ...but I prefer to having non-parents .enable() or .disable()
> the service. Of course, it can start enabled by default, but
> this way you have a clear distinction which methods are supposed
> to be called by whom.

Hmm, I guess I don't quite understand this.  Why should it matter if a
services is being started by the parent or not?  Is there a chance the
parent could think the service was still running when it really wasn't?

This is an important point to me as I like the idea of letting
administrators turn services on and off without stopping the
application.

> If you call it "application" insteadof "myApp", the next line
> is not needed: instead of "Python"ing it, "twistd -y" it
> [or maybe twistd -ny if you don't want forking]

If I do this, I get an error on shutdown, as it tries to create a
snapshot of the running app:

2003/07/14 22:22 EDT [*Test App*] Saving Test App application to Test
App-shutdown.tap...
2003/07/14 22:22 EDT [*Test App*] Traceback (most recent call last):
          File
"/usr/lib/python2.2/site-packages/twisted/python/context.py", line 32,
in callWithContext
            return func(*args,**kw)
          File
"/usr/lib/python2.2/site-packages/twisted/internet/default.py", line
122, in run
            self.mainLoop()
          File
"/usr/lib/python2.2/site-packages/twisted/internet/default.py", line
130, in mainLoop
            self.runUntilCurrent()
          File
"/usr/lib/python2.2/site-packages/twisted/internet/base.py", line 368,
in runUntilCurrent
            call.func(*call.args, **call.kw)
        --- <exception caught here> ---
          File
"/usr/lib/python2.2/site-packages/twisted/internet/base.py", line 289,
in _continueSystemEvent
            callable(*args, **kw)
          File
"/usr/lib/python2.2/site-packages/twisted/internet/app.py", line 784, in
_afterShutDown
            self.save("shutdown")
          File
"/usr/lib/python2.2/site-packages/twisted/internet/app.py", line 745, in
save
            dumpFunc(self, f)
          File
"/usr/lib/python2.2/site-packages/twisted/internet/app.py", line 727, in
dumpFunc
            _dump(obj, file, 1)
        cPickle.PicklingError: Can't pickle
__builtin__.ServiceWebManager: it's not found as
__builtin__.ServiceWebManager

Do you know how to fix this?

Thanks,
Abe






More information about the Twisted-Python mailing list