[Twisted-Python] Beginner question: integrating with CORBA

Jean-Paul Calderone exarkun at divmod.com
Mon Jun 25 07:46:36 EDT 2007

On Mon, 25 Jun 2007 12:03:46 +0100, Dave Kirby <d.kirby at tideway.com> wrote:
>I have just started looking at Twisted, and it looks really cool and
>useful.  I have read through much of the docs and the O'Reilly book, but
>I still have a head full of questions.
>First some background.  I am considering using Twisted to replace a
>component in a network management suite.  All the components communicate
>through CORBA (omniORB).  The component I want to replace gets CORBA
>calls that requests data from servers on the network, and the component
>retrieves the data using ssh.  Currently it spawns /usr/bin/ssh and uses
>pexpect to control the interaction.  Typically we will have 20-40
>simultaneous calls in progress to different IP addresses, each on a
>separate thread and each spawning a separate ssh client.
>I want to replace this with a component that uses Twisted instead.  From
>what I have read Twisted should be ideal for this - I can use the conch
>library to do the ssh calls and eliminate the need for spawning dozens
>of separate processes (something that has been a major cause of bugs).
>The first problem I have is how to integrate the omniORB event loop with
>the reactor event loop.  My initial thoughts are to have the omniORB
>event loop in one thread and run the reactor loop in another thread.
>When a CORBA call comes in it will use callFromThread()  to post a
>request to the Twisted thread that will create the connection and handle
>the ssh session.  Is this feasible?  Any gotchas to watch out for?

This is probably the most straightforward approach.  It's not as desirable
as one that doesn't involve threads at all, but it gives you the integration
you're after with the least development overhead, and it leaves a pretty
straightforward path for ultimately switching away from threads entirely,
should the opportunity to do that work arise (by incrementally replacing
code in the omniORB thread with code that performs an equivalent task in
the Twisted reactor thread).

>However I have also seen reference to using threadedselectreactor for
>mixing Twisted and foreign even loops
>loops/), but I have no idea how to use this with omniORB.  Is this worth
>investigating further, or should I stick with my original idea?

I consider threadedselectreactor a non-starter due to the state of its
test coverage and the general mystery surrounding how application-level
tests are written for code which requires it.

>Replacing CORBA with the Twisted PerspectiveBroker is not an option,
>since it would require extensively rewriting a dozen or so components.

How about doing a Twisted implementation of CORBA? ;)


More information about the Twisted-Python mailing list