[Twisted-Python] Beginner question: integrating with CORBA

Chris Laws clawsicus at gmail.com
Mon Jun 25 07:04:31 MDT 2007


>
> ---------- Forwarded message ----------
> From: "Dave Kirby" <D.Kirby at tideway.com>
> To: <twisted-python at twistedmatrix.com>
> Date: Mon, 25 Jun 2007 12:03:46 +0100
> Subject: [Twisted-Python] Beginner question: integrating with CORBA
>
> 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?
>
>
>
> However I have also seen reference to using threadedselectreactor for
> mixing Twisted and foreign even loops (
> http://bob.pythonmac.org/archives/2005/04/17/twisted-and-foreign-event-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?
>
>
>
> Replacing CORBA with the Twisted PerspectiveBroker is not an option, since
> it would require extensively rewriting a dozen or so components.
>
>
>
> I have plenty of other questions, but will save them for another time.
>
>
>
> Dave Kirby
>
>
I just got back into a similar thing today after about a month of inactivity
on the issue. I posted about it here a while back but got no responses.
I'm trying to convert a simple Python/Omniorb CORBA Event Channel client
script so that it can robustly handle a separate federated Name Service
disappearing. I'm planning on running it using twisted for various reasons
(common code, available functionality, etc). So I need to work out if I can
use Twisted and CORBA (Omniorb to be specific) together, ideally within the
same thread.

Currently the simple script has a Tkinter UI which also registers a callback
method with the Event Channel client wrapper to handle Event Messages. A
self-rescheduling callback is also configured to drive the Orb, at some
variable rate, and then the script is handled by the Tkiner mainloop. At
regular intervals the Orb is run then rescheduled and then control is
returned back to the Tk mainloop. I'm at home and can't remember the exact
code but something along the lines of:

def runOrb(self):
    if self.orb.work_pending():
        self.orb.perform_work()

This all seems to work well. However the script is fairly simple in that
it's only monitoring and reacting to Event Channel messages, so slightly
different from your use. However, I think that it demonstrates that the orb
can be run from within another event processing loop within the same single
thread - in this case the Tk mainloop.
Now the Tk event processing can be handled by the tksupport package so I
thought why not use that model for a CORBA support package?
I've totally copied the tksupport file (it's very small) and converted it to
perform the running and re-scheduling of the CORBA orb.

Sorry I can't provide you more info but as mentioned above I only got back
into this today (no testing yet) plus I finish work at that company in a few
days. If I get anywhere I'll post back some info. Hopefully it gives you
something to look into.

Regards,
Chris Laws
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20070625/1fca5411/attachment.html>


More information about the Twisted-Python mailing list