[Twisted-Python] How to make a service dependent of another?
Terry Jones
terry at jon.es
Fri May 15 02:46:00 MDT 2009
>>>>> "Gus" == coder gus <coder_gus at lavabit.com> writes:
Gus> I have a pb client and a tcp server. How can I make the server start
Gus> only after/if the client started?
Hi Gus
You might take a look at the code here
http://www.twistedmatrix.com/pipermail/twisted-python/2009-February/019249.html
and if you go back a couple of mails in that thread you'll see some more
discussion. BTW, this approach hasn't received much comment, so you
shouldn't assume it's bulletproof or even recommended. But I use it many
times every day to launch about half a dozen twistd multiservices, and have
never had a problem.
You use it like a regular multiservice, but you can pass it a service which
is treated slightly specially. The other services you add will not be
started unless the service you pass to __init__ starts properly (you can
know this by having its startService return a deferred). Make sense?
Terry
More information about the Twisted-Python
mailing list