[Twisted-Python] Service dependencies
exarkun at divmod.com
Thu Jan 19 10:29:31 EST 2006
On Thu, 19 Jan 2006 14:32:13 +0100, Eric Faurot <eric.faurot at gmail.com> wrote:
>On 1/19/06, Matt Goodall <matt at pollenation.net> wrote:
>> In other words, what is the recommended way of starting services in the
>> correct order, including waiting for them to get initialised fully,
>> these days?
>I'd say if service B relies on servcie A, then B.startService
>must explicitely call A.startService().
>Of course, it requires that A.startService must be a noop if called more
Not a very common property of startService(). Few, if any, of the services Twisted provides offer this property.
>Now for deferred, I'm not 100% sure, but I don't think there is something
>very wrong returning a deferred in startService.
Well, you won't get a spanking for it. Nothing pays any attention to the return value of startService, though.
privilegedStartService is run before the reactor has started, so there's no way it could support Deferreds.
startService could probably be modified to support Deferreds. MultiService is pretty lax about.... everything. I think this is just one of many possible improvements that could be made.
More information about the Twisted-Python