[Twisted-Python] defer.gatherResults & Deferreds chaining

Jorge Gonzalez gjorge at google.com
Wed Jul 31 11:08:01 MDT 2013


I found the root cause, and it has nothing to do with Deferreds nor
DeferredLists. It was something else in my code unrelated to twisted.

Thanks!
Jorge


On Tue, Jul 30, 2013 at 3:40 PM, Jorge Gonzalez <gjorge at google.com> wrote:

> Thanks Glyph.
> I actually am not able to reduce the behavior to a simpler runnable
> example yet, and that's why I tried running my theory first through this
> list.
> I did try a simple example just instantiating some Deferreds, firing them
> and gathering their results into a DeferredList (no reactor involved) and
> what you're saying holds true. So I'm working on getting a simpler version
> of my code that exposes the behavior I'm seeing and will post it once I
> have it.
>
> Jorge
>
>
> On Mon, Jul 29, 2013 at 4:04 PM, Glyph <glyph at twistedmatrix.com> wrote:
>
>>
>> On Jul 29, 2013, at 1:29 PM, Jorge Gonzalez <gjorge at google.com> wrote:
>>
>>  Wouldn't it be possible that defer.gatherResults inserts its callback
>> into d before say slowFuncReturningDeferred_B gets to run and return its
>> own Deferred (and therefore chain it to what gatherRestults is ultimately
>> waiting for?). If so, wouldn't the results returned by
>> slowFuncReturningDeferred_B never make it to the results gathered by
>> defer.gatherResults?
>>
>>
>> No, that's not what happens.  You call addCallback(lambda _:
>> slowFunc...A()), then you call gatherResults.  That means gatherResult's
>> callback is after slowFuncReturningA() in d's callback chain.
>>
>> Can you attach an actual runnable code example with some behavior that
>> you didn't expect, so we can actually run it and explain what's happening?
>>  No need for you to spin the reactor or anything, just instantiate a
>> Deferred and then fire it.
>>
>> -glyph
>>
>>
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130731/b3523e29/attachment-0001.html>


More information about the Twisted-Python mailing list