[Twisted-Python] Wrapping blocking code

Bob Ippolito bob at redivi.com
Wed Jul 23 18:54:48 EDT 2003


On Wednesday, Jul 23, 2003, at 12:16 America/New_York, Justin Johnson 
wrote:

> I have some code in my xmlrpc service that executes commands using
> process.py (http://starship.python.net/crew/tmick/).  The service 
> appears
> to block this code, thus only allowing one connection to get any work
> done at a time, at least while the commands are being executed.  
> Should I
> be wrapping this up in a Deferred somehow to avoid blocking?
>
> Slowly but surely this is starting to make sense to me.  Twisted rocks!

Ideally you would convert your process.py dependent code to something 
that uses reactor.spawnProcess() with a ProcessProtocol that does what 
you need with the process.  You may still want to use process.py to do 
the argument conversion, because I don't believe this functionality is 
duplicated in Twisted.

  See: http://www.twistedmatrix.com/documents/howto/process

-bob





More information about the Twisted-Python mailing list