Re: [Twisted-Python] Using a custom reactor in twisted trial for test cases?

2009-11-01 Thread Crispin Wellington
On Mon, 2009-11-02 at 01:12 -0500, Glyph Lefkowitz wrote: > On Nov 1, 2009, at 11:17 PM, Crispin Wellington wrote: > > I tried using LoopingCall, but it does not work. It only calls the > > scheduler once. I think this has to do with the fact that the > > stackless > > scheduler needs to be inte

Re: [Twisted-Python] Using a custom reactor in twisted trial for test cases?

2009-11-01 Thread Glyph Lefkowitz
On Nov 1, 2009, at 11:17 PM, Crispin Wellington wrote: > On Fri, 2009-10-30 at 14:06 +, exar...@twistedmatrix.com wrote: >> It looks like your custom reactor is mainly in charge of making sure >> stackless.schedule() gets called at least once every 0.1 seconds. Is >> that right? If so, a muc

Re: [Twisted-Python] Using a custom reactor in twisted trial for test cases?

2009-11-01 Thread Crispin Wellington
On Fri, 2009-10-30 at 14:06 +, exar...@twistedmatrix.com wrote: > As for your actual question, if you want a new reactor to be as usable > as one of the existing ones, you need to write a plugin declaring its > available. Take a look at twisted/plugins/twisted_reactors.py for some > example

Re: [Twisted-Python] Using a custom reactor in twisted trial for test cases?

2009-11-01 Thread Crispin Wellington
On Fri, 2009-10-30 at 14:06 +, exar...@twistedmatrix.com wrote: > It looks like your custom reactor is mainly in charge of making sure > stackless.schedule() gets called at least once every 0.1 seconds. Is > that right? If so, a much better approach would be to use > twisted.internet.task.

Re: [Twisted-Python] Retrying function calls

2009-11-01 Thread Terry Jones
Hi Tim > Since this is a generator function, it will automatically raise > StopIteration once control-flow falls off the end of the function, so your > while-loop could just be written: Ah yes, thanks a lot. Terry ___ Twisted-Python mailing list Twist

Re: [Twisted-Python] PyObjC and Twisted command line script

2009-11-01 Thread David Bolen
Jonathan Stoppani writes: > Hi Ronald, > thanks for the response. I already saw the examples on the pyobjc > website, but they (two) are all using Cocoa to do some GUI related > work. > > I don't have a gui and I use the console loop instead. > > I'm now trying to use the code attached to this ti

Re: [Twisted-Python] Retrying function calls

2009-11-01 Thread Tim Allen
On Sun, Nov 01, 2009 at 05:53:31PM +0100, Terry Jones wrote: > def simpleBackoffIterator(maxResults=10, maxDelay=5.0, now=True, > initDelay=0.01, incFunc=None): > assert maxResults > 0 > remaining = maxResults > delay = initDelay > incFunc = incFunc or part

Re: [Twisted-Python] Retrying function calls

2009-11-01 Thread Terry Jones
Hi Blair > Looks pretty good. To streamline the usage and make the intent more > apparent from a brief glance at the header you might consider turning it > into a decorator, like Thanks for the suggestion & the pointer. I'd not seen that page. I don't think this is well suited to decorators, at

Re: [Twisted-Python] Retrying function calls

2009-11-01 Thread Blair Bethwaite
Hi Terry, 2009/11/1 Terry Jones : > My questions are: Is this robust? Can/should it be improved?  Any criticism > of the code (especially wrt Twisted best practices) would be very welcome. Looks pretty good. To streamline the usage and make the intent more apparent from a brief glance at the hea

Re: [Twisted-Python] Retrying function calls

2009-11-01 Thread Terry Jones
Following up on my own post: > When the backoff iterator finishes, the RetryingCall class gives up on > trying to get a non-error result from the function. In that case you just > get a StopIteration exception in the failure that start() deferred > returns (I was originally returning the original

[Twisted-Python] Retrying function calls

2009-11-01 Thread Terry Jones
These days I often find myself writing code to talk to services that are periodically briefly unavailable. An error of some kind occurs and the correct (and documented) action to take is just to retry the original call. Examples include using Amazon's S3 service and the Twitter API. In both of thes

Re: [Twisted-Python] PyObjC and Twisted command line script

2009-11-01 Thread Jonathan Stoppani
Hi Ronald, thanks for the response. I already saw the examples on the pyobjc website, but they (two) are all using Cocoa to do some GUI related work. I don't have a gui and I use the console loop instead. I'm now trying to use the code attached to this ticket and it seems to work, but I have to t

Re: [Twisted-Python] PyObjC and Twisted command line script

2009-11-01 Thread Ronald Oussoren
The pyobjc website contains a number of examples using twisted. Ronald On 1 nov 2009, at 11:45, Jonathan Stoppani wrote: > Hi All, > I just set up a script to do a video recording from my iSight using > the pyobjc bridge and the QTKit framework. > This script uses the AppHelper.runConsoleEv

[Twisted-Python] PyObjC and Twisted command line script

2009-11-01 Thread Jonathan Stoppani
Hi All, I just set up a script to do a video recording from my iSight using the pyobjc bridge and the QTKit framework. This script uses the AppHelper.runConsoleEventLoop (not the AppHelper.runEventLoop) function to start his main event loop. I'd like to integrate this script with an existing twist