[Twisted-Python] Sequential use of asynchronous calls

Gábor Bernáth gabor.bernath at gmail.com
Sat May 26 11:20:31 MDT 2007


inlineCallbacks are similar to what you are doing. very cool stuff.

http://twistedmatrix.com/pipermail/twisted-python/2007-February/014869.html
http://mesozoic.geecs.org/

cheers,
gabor


On 5/26/07, Maarten ter Huurne <maarten at treewalker.org> wrote:
> On Saturday 26 May 2007, Ed Suominen wrote:
>
> > http://foss.eepatents.com/api/twisted-goodies/taskqueue.base.TaskQueue.html
>
> That looks interesting, but I don't think it has the same purpose.
>
> If I understand it correctly, TaskQueue dispatches synchronous calls to a pool
> of workers. The thing I posted runs a series of asynchronous calls in
> succession. In other words, TaskQueue handles callables, while "@sequential"
> handles Deferreds.
>
> Also, TaskQueue seems to be designed for running a number of indepedent tasks,
> while "@sequential" is designed for situations in which call n+1 depends on
> the result of call n. The added value of "@sequential" is that you don't have
> to deal with Deferreds yourself, but can use the return value of the yield
> instead (or the exception thrown by it).
>
> The original example did not demonstrate using the result of a previous call
> in the next call. Here is a new implementation of the "work" method which
> does:
>
> ===
> @sequential
> def work():
>     value = 9
>     try:
>         while True:
>             print value
>             value = (yield getDummyData(value)) - 20
>     except ValueError, e:
>         print 'failed:', e
> ===
>
> Bye,
>                 Maarten
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
>




More information about the Twisted-Python mailing list