Re: [Twisted-Python] blocking and threads
![](https://secure.gravatar.com/avatar/82c5d6a9d069403a1a05228f04385eb9.jpg?s=120&d=mm&r=g)
Thanks, how embarassing... I suggest adding it to the "using threads" howto (I'd do it myself if I knew how). Another idea: make an asynchronous file-handling module that wraps Python's file IO with something that has a deferred-oriented interface. Is there already something like that too? Joe --- Jp Calderone <exarkun@divmod.com> wrote:
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
![](https://secure.gravatar.com/avatar/7ed9784cbb1ba1ef75454034b3a8e6a1.jpg?s=120&d=mm&r=g)
On Wed, 27 Apr 2005 07:07:15 -0700 (PDT), Joachim Boomberschloss <boomberschloss@yahoo.com> wrote:
There's not, yet (although likely the VFS project Chris Armstrong, Andy Gayton, Tim Stebbing, and Andrew Bennetts recently started on will probably encompass this at some point). For many projects, asynchronous disk file i/o isn't actually that important. They either only do a little bit of it, or they can fragment it over multiple reactor iterations manually without too much effort. This is probably the main reason there isn't something like adbapi for files in Twisted already. For projects that do a lot of disk IO (like an ftp server, say :), or have latency requirements more stringent than average, an asynchronous file API would definitely be useful. Jp
![](https://secure.gravatar.com/avatar/cc73f0ce7066be790eeeb1fe2d38a5ac.jpg?s=120&d=mm&r=g)
On 4/27/05, Jp Calderone <exarkun@divmod.com> wrote:
can you explain the "fragement it over multiple reactor itertations" please? I actually have a project that it is very import and we are trying to figure out the best way to do this type of thing
![](https://secure.gravatar.com/avatar/4e4f53ee9644170a0ed0551debad8da1.jpg?s=120&d=mm&r=g)
jarrod roberson wrote:
see if this thread is helpful: http://twistedmatrix.com/pipermail/twisted-python/2005-March/009950.html I'm using this technique which boils down to reactor.callLater(0, recursive_function, args) I also tried reactor.iterate() (http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.I... ) - although this prevented blocking for some reason it had some undesirable side effects with my app. regards, Eugene Coetzee -- -- =============================================== Reedflute Software Solutions Telephone -> +27 18 293 3236 General information -> info@reedflute.com Project information -> projects@reedflute.com Web -> www.reedflute.com ===============================================
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Tue, 2005-05-03 at 18:07 +0200, Eugene Coetzee wrote:
I also tried reactor.iterate()
(http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.I... )
Don't do that, reactor.iterate() is not something Twisted applications should use.
![](https://secure.gravatar.com/avatar/4e4f53ee9644170a0ed0551debad8da1.jpg?s=120&d=mm&r=g)
Itamar Shtull-Trauring wrote:
Ok, perhaps that was a bit of wishful thinking :-) It would have been kind of neat if one could call something like reactor.yield(thisfunc,delay) from within a time consuming loop instead of the recursive workaround or resorting to a multithreaded approach.
![](https://secure.gravatar.com/avatar/7ed9784cbb1ba1ef75454034b3a8e6a1.jpg?s=120&d=mm&r=g)
On Wed, 27 Apr 2005 07:07:15 -0700 (PDT), Joachim Boomberschloss <boomberschloss@yahoo.com> wrote:
There's not, yet (although likely the VFS project Chris Armstrong, Andy Gayton, Tim Stebbing, and Andrew Bennetts recently started on will probably encompass this at some point). For many projects, asynchronous disk file i/o isn't actually that important. They either only do a little bit of it, or they can fragment it over multiple reactor iterations manually without too much effort. This is probably the main reason there isn't something like adbapi for files in Twisted already. For projects that do a lot of disk IO (like an ftp server, say :), or have latency requirements more stringent than average, an asynchronous file API would definitely be useful. Jp
![](https://secure.gravatar.com/avatar/cc73f0ce7066be790eeeb1fe2d38a5ac.jpg?s=120&d=mm&r=g)
On 4/27/05, Jp Calderone <exarkun@divmod.com> wrote:
can you explain the "fragement it over multiple reactor itertations" please? I actually have a project that it is very import and we are trying to figure out the best way to do this type of thing
![](https://secure.gravatar.com/avatar/4e4f53ee9644170a0ed0551debad8da1.jpg?s=120&d=mm&r=g)
jarrod roberson wrote:
see if this thread is helpful: http://twistedmatrix.com/pipermail/twisted-python/2005-March/009950.html I'm using this technique which boils down to reactor.callLater(0, recursive_function, args) I also tried reactor.iterate() (http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.I... ) - although this prevented blocking for some reason it had some undesirable side effects with my app. regards, Eugene Coetzee -- -- =============================================== Reedflute Software Solutions Telephone -> +27 18 293 3236 General information -> info@reedflute.com Project information -> projects@reedflute.com Web -> www.reedflute.com ===============================================
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Tue, 2005-05-03 at 18:07 +0200, Eugene Coetzee wrote:
I also tried reactor.iterate()
(http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.I... )
Don't do that, reactor.iterate() is not something Twisted applications should use.
![](https://secure.gravatar.com/avatar/4e4f53ee9644170a0ed0551debad8da1.jpg?s=120&d=mm&r=g)
Itamar Shtull-Trauring wrote:
Ok, perhaps that was a bit of wishful thinking :-) It would have been kind of neat if one could call something like reactor.yield(thisfunc,delay) from within a time consuming loop instead of the recursive workaround or resorting to a multithreaded approach.
participants (5)
-
Eugene Coetzee
-
Itamar Shtull-Trauring
-
jarrod roberson
-
Joachim Boomberschloss
-
Jp Calderone