Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Axel Rau
Am 17.02.2014 um 23:58 schrieb Dustin J. Mitchell : > Async programming aside, this mode of chaining multiple methods > doesn't sit well with me: > > def A() > # .. do stuff > B() > > def B() > # .. do stuff > C() > > I think it'd be more idiomatic to have a controlling method that > indic

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Dustin J. Mitchell
On Tue, Feb 18, 2014 at 10:11 AM, Axel Rau wrote: > Thanks, but the calls in C depend on the data (program branches). > There are 8 different call parameter sets dependent on contexts. I still believe that making those dependencies visible is a good idea. At any rate, in your original code:

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Laurens Van Houtven
On Tue, Feb 18, 2014 at 4:21 PM, Dustin J. Mitchell wrote: > D is returning a Deferred, but you're not doing anything with it. In > fact, all of A..E are returning Deferreds and you're ignoring them. > In an inlineCallbacks-decorated method, you need to yield every > Deferred you receive. > I re

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Dustin J. Mitchell
True, I only mean that def A(self): ... tmp = yield subprocess(args) ... self.B() leaves the deferred from B totally unhandled, which is nearly always a bad thing. Dustin ___ Twisted-Python mailing list Twisted-Pyth

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Axel Rau
Am 18.02.2014 um 16:34 schrieb Dustin J. Mitchell : > True, I only mean that > >def A(self): >... >tmp = yield subprocess(args) >... >self.B() > > leaves the deferred from B totally unhandled, which is nearly always a > bad thing. Is this true, if I have a yi

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Dustin J. Mitchell
That handles the Deferred from subprocess(args), but it doesn't handle the Deferred from self.C() On Tue, Feb 18, 2014 at 11:40 AM, Axel Rau wrote: > > Am 18.02.2014 um 16:34 schrieb Dustin J. Mitchell : > >> True, I only mean that >> >>def A(self): >>... >>tmp = yield subproc

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Axel Rau
Am 18.02.2014 um 17:45 schrieb Dustin J. Mitchell : > That handles the Deferred from subprocess(args), but it doesn't handle > the Deferred from self.C() And that calls three times self.D, which has a yield. What is wrong with my reasoning? Something prevents the inline callback in self.D to wait

Re: [Twisted-Python] Deadlocks when launching processes - how to investigate?

2014-02-18 Thread Glyph Lefkowitz
On Feb 15, 2014, at 5:32 PM, exar...@twistedmatrix.com wrote: > On 15 Feb, 07:58 pm, gl...@twistedmatrix.com wrote: >> >> The one thing that confused me was that the sample program appeared to be >> running the program only once a second, and waiting for it to complete >> before running it aga

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Dustin J. Mitchell
I'm suggesting that there are lots more problems with your code than the one you have identified. Any method which is decorated with @defer.inlineCallbacks will return a Deferred, and you need to handle every Deferred somehow. Generally (although not always, as lvh has said) you do that by yieldi

Re: [Twisted-Python] Deadlocks when launching processes - how to investigate?

2014-02-18 Thread Glyph Lefkowitz
On Feb 15, 2014, at 5:32 PM, exar...@twistedmatrix.com wrote: > On 15 Feb, 07:58 pm, gl...@twistedmatrix.com wrote: >> >> The one thing that confused me was that the sample program appeared to be >> running the program only once a second, and waiting for it to complete >> before running it aga

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Axel Rau
Am 18.02.2014 um 20:03 schrieb Dustin J. Mitchell : > I'm suggesting that there are lots more problems with your code than > the one you have identified. Any method which is decorated with Sure. This is my 1st project with twisted. (-; > @defer.inlineCallbacks will return a Deferred, This is th

Re: [Twisted-Python] serializing inline callbacks

2014-02-18 Thread Dustin J. Mitchell
On Tue, Feb 18, 2014 at 4:58 PM, Axel Rau wrote: > I see log message ‚imageMap ended‘ , but not 'In navigation.' > Any further advice? I'm guessing that you omitted @inlineCallbacks for navigation, but that it contains a yield. In Python, that makes it a plain old generator expression, which ju

Re: [Twisted-Python] Deadlocks when launching processes - how to investigate?

2014-02-18 Thread exarkun
On 18 Feb, 07:29 pm, gl...@twistedmatrix.com wrote: On Feb 15, 2014, at 5:32 PM, exar...@twistedmatrix.com wrote: On 15 Feb, 07:58 pm, gl...@twistedmatrix.com wrote: The one thing that confused me was that the sample program appeared to be running the program only once a second, and waiting

Re: [Twisted-Python] Deadlocks when launching processes - how to investigate?

2014-02-18 Thread Glyph Lefkowitz
On Feb 18, 2014, at 6:07 PM, exar...@twistedmatrix.com wrote: > On 18 Feb, 07:29 pm, gl...@twistedmatrix.com wrote: >> >> On Feb 15, 2014, at 5:32 PM, exar...@twistedmatrix.com wrote: >>> On 15 Feb, 07:58 pm, gl...@twistedmatrix.com wrote: The one thing that confused me was that the s

Re: [Twisted-Python] Deadlocks when launching processes - how to investigate?

2014-02-18 Thread exarkun
On 02:50 am, gl...@twistedmatrix.com wrote: On Feb 18, 2014, at 6:07 PM, exar...@twistedmatrix.com wrote: On 18 Feb, 07:29 pm, gl...@twistedmatrix.com wrote: On Feb 15, 2014, at 5:32 PM, exar...@twistedmatrix.com wrote: On 15 Feb, 07:58 pm, gl...@twistedmatrix.com wrote: The one thing that