Re: [Twisted-Python] Graceful shutdown of twistd application

2014-09-05 Thread Fabio Sangiovanni
Hi, I just wanted to give an update about the way I got it, in case this could be useful for somebody. I essentially inherited from service.MultiService like this: class GracefulMultiService(service.MultiService): def stopService(self): d = defer.succeed(None) d.addCallback(s

Re: [Twisted-Python] Graceful shutdown of twistd application

2014-09-04 Thread exarkun
On 12:36 pm, sangiova...@nweb.it wrote: On Thu, Sep 4, 2014 at 2:02 PM, wrote: You said before shutdown triggers are too late but you didn't say why. I think that's based on a misunderstanding - but if not, then explain why it doesn't work for your scenario. Hi, thanks for your reply. I

Re: [Twisted-Python] Graceful shutdown of twistd application

2014-09-04 Thread Fabio Sangiovanni
On Thu, Sep 4, 2014 at 2:02 PM, wrote: > > > You said before shutdown triggers are too late but you didn't say why. I > think that's based on a misunderstanding - but if not, then explain why it > doesn't work for your scenario. > Hi, thanks for your reply. I've tried the following: def sleep(

Re: [Twisted-Python] Graceful shutdown of twistd application

2014-09-04 Thread exarkun
On 10:52 am, sangiova...@nweb.it wrote: Hello list, I need to implement a graceful shutdown procedure for a twistd application. The application is made up of two services: an internet.TCPClient and an internet.TCPServer. They're glued together with a MultiService instance, which is in turn se

[Twisted-Python] Graceful shutdown of twistd application

2014-09-04 Thread Fabio Sangiovanni
Hello list, I need to implement a graceful shutdown procedure for a twistd application. The application is made up of two services: an internet.TCPClient and an internet.TCPServer. They're glued together with a MultiService instance, which is in turn set to have 'application' as parent. The server

Re: [Twisted-Python] Graceful shutdown

2013-08-29 Thread Jonas Lindmark
Thanks for the link. Looking at your code I found the magic lines I was missing. Implementing my own HTTPChannel was the key to success. Now I don't have to poll reactor.getWriters() to see if there are unfinished writers. I ended up with something like this: class ApiHTTPChannel(HTTPChannel):

Re: [Twisted-Python] Graceful shutdown

2013-08-28 Thread Aaron Gallagher
I didn't read over your code, but this is something that I've independently implemented. You can see my implementation at . The Site subclass does some other monitoring-related things, but you should be able to tease out just the graceful

[Twisted-Python] Graceful shutdown

2013-08-28 Thread Jonas Lindmark
Hi! I'm trying to implement graceful shutdown of a HTTP server and I am unsure of the preferred way of implementing it. I'm attempting to do this by adding a system event trigger for "before" "shutdown" that should stop accepting new requests and wait for current ones to finish. My problem is th