[Twisted-Python] Service.stopService

Jp Calderone exarkun at divmod.com
Fri May 21 09:54:43 EDT 2004


Bill la Forge wrote:
> I have a very simple application--I'm testing service start and stop.
> Woops--stopService is never called. Why?
>  
> Here's my simpleService.py:
>  
> from twisted.application import service
> class SimpleService(service.Service):
>     def startService(self):
>         service.Service.startService(self)
>         print '***start'
>     def stopService(self):
>         service.Service.stopService(self)
>         print '***stop'
> And here's my twistd script:
>  
> from twisted.application import service
> import simpleService
> application = service.Application('testService', uid=1, gid=1)
> serviceCollection=service.IServiceCollection(application)
> w = simpleService.SimpleService()
> s.setServiceParent(serviceCollection)
> It logs ***start, just fine. But never ***stop!
>  
> Is something broken? Or should I be using addSystemEventTrigger???
> 

   I see different behavior.  After changing the last line to use "w" 
instead of "s":

exarkun at boson:~$ twistd -noy simple.tac
2004/05/21 09:52 EDT [-] Log opened.
2004/05/21 09:52 EDT [-] twistd 1.3.0rc1 (/usr/bin/python 2.3.3) starting up
2004/05/21 09:52 EDT [-] reactor class: 
twisted.internet.default.SelectReactor
2004/05/21 09:52 EDT [-] Loading simple.tac...
2004/05/21 09:52 EDT [-] Loaded.
2004/05/21 09:52 EDT [-] set uid/gid 1000/1000
2004/05/21 09:52 EDT [-] ***start
2004/05/21 09:52 EDT [-] Received SIGINT, shutting down.
2004/05/21 09:52 EDT [-] ***stop
2004/05/21 09:52 EDT [-] Main loop terminated.
2004/05/21 09:52 EDT [-] Server Shut Down.
exarkun at boson:~$

   Jp




More information about the Twisted-Python mailing list