Make zerorpc working with pyzmq > 13.0.2

- there is a issue with zerorpc.gevent_zmq implementation when pyzmq >
  13.0.2 AND when gevent.patch_all() is done BEFORE importing gevent_zmq
- I added workaround that makes stuff working

Closes-bug: #1549271

Change-Id: I1951a564ace23e3150ecc6d20449036c4e4e10fc
This commit is contained in:
Jedrzej Nowak 2016-02-24 14:24:53 +01:00
parent f96c5bf0d4
commit 3e8d9ac48e
2 changed files with 17 additions and 5 deletions

View File

@ -27,8 +27,9 @@ semver>=2.4.0
# plugins
stevedore>=1.5.0
#zerorpc doesnt consume messages with >13.0.2, need to debug
pyzmq==13.0.2
# NOTE(jnowak): there is a bug in zerorpc, if pyzmq>13.0.2
# working workaround included
pyzmq>=13.0.2
zerorpc>=0.5.2

View File

@ -15,10 +15,21 @@
import sys
import gevent
import zerorpc
from solar.core.log import log
from solar.orchestration.executors import base
# NOTE(jnowak): this is a workaround for bug in zerorpc.gevent_zmq
# it's broken on gevent patched environments and when
# pyzmq > 13.0.2
import zmq.green as zmq
if tuple(map(int, zmq.__version__.split('.'))) > (13, 0, 2):
sys.modules['zmq'] = zmq
else:
del zmq
# NOTE(jnowak): NOQA because of workaround above (E402)
import zerorpc # NOQA
from solar.core.log import log # NOQA
from solar.orchestration.executors import base # NOQA
class PoolBasedPuller(zerorpc.Puller):