[ovs-dev] [PATCH] python/ovs/poller: monkey patch to select.poll for eventlet/gevent

Ben Pfaff blp at nicira.com
Thu Aug 30 18:25:25 UTC 2012


On Fri, Aug 31, 2012 at 03:19:57AM +0900, Isaku Yamahata wrote:
> On Wed, Aug 29, 2012 at 10:18:59AM -0700, Ben Pfaff wrote:
> > On Tue, Aug 28, 2012 at 05:37:06PM +0900, Isaku Yamahata wrote:
> > > On Mon, Aug 27, 2012 at 10:10:13PM -0700, Ben Pfaff wrote:
> > > > On Wed, Aug 22, 2012 at 07:07:05PM +0900, Isaku Yamahata wrote:
> > > > > eventlet/gevent doesn't work well with select.poll because it blocks.
> > > > > So ovsdb python binding can't be used with eventlet/gevent.
> > > > > So monkey patch to select.poll with a function that emulate select.poll
> > > > > with select.select.
> > > > > 
> > > > > Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
> > > > 
> > > > What's going to use this?
> > > 
> > > My motivation is to use ovsdb python binding in openstack quantum which
> > > uses eventlet (I have Ryu plugin in mind, but I think other plugin can
> > > benefit) and in Ryu which uses gevent.
> > 
> > Hmm.  Depending on the way that the code is structured, you might be
> > able to just pass an object of a different class that simply implements
> > fd_wait, timer_wait, timer_wait_until, and immediate_wake differently.
> > Did you consider that solution?  Or we could define an abstract
> > superclass for Poller with the current Poller as the default concrete
> > definition.  I'd be open to that, if it would help.
> 
> Then I'd like to introduce an abstract superclass.
> How about this?

That looks OK.

But I think you might have implied that just switching from "poll" to
"select" also fixes the problem.  Is that correct?  If so, then maybe we
should just use select everywhere.  The main difference between poll and
select is performance, and performance of the Python code isn't critical
(otherwise we wouldn't write it in Python).

Thanks,

Ben.



More information about the dev mailing list