Projects
Kolab:3.4:Updates
bonnie
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 30
View file
bonnie.spec
Changed
@@ -26,6 +26,9 @@ URL: https://kolab.org Source0: %{name}-%{version}.tar.gz +Patch0001: 0001-Fork-the-dealer-process-to-the-background-at-the-ear.patch +Patch0002: 0002-Upgrade-the-ZMQ-output-to-run-under-a-tornado-ioloop.patch + BuildArch: noarch Requires(pre): /usr/sbin/useradd @@ -114,6 +117,9 @@ %prep %setup -q +%patch0001 -p1 +%patch0002 -p1 + %build %install
View file
0001-Fork-the-dealer-process-to-the-background-at-the-ear.patch
Added
@@ -0,0 +1,36 @@ +From cc0262ef87f6ea84a763ab6d020dd8b8e312018e Mon Sep 17 00:00:00 2001 +From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> +Date: Fri, 21 Nov 2014 22:37:31 +0100 +Subject: [PATCH 1/2] Fork the dealer process to the background at the earliest + opportunity + +--- + dealer.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/dealer.py b/dealer.py +index a02771d..1492fa9 100755 +--- a/dealer.py ++++ b/dealer.py +@@ -1,6 +1,7 @@ + #!/usr/bin/python + + import json ++import os + import sys + + from bonnie.dealer import BonnieDealer +@@ -8,5 +9,8 @@ from bonnie.dealer import BonnieDealer + if __name__ == "__main__": + notification = sys.stdin.read().strip() + +- dealer = BonnieDealer() +- dealer.run(notification) ++ newpid = os.fork() ++ ++ if newpid == 0: ++ dealer = BonnieDealer() ++ dealer.run(notification) +-- +1.9.3 +
View file
0002-Upgrade-the-ZMQ-output-to-run-under-a-tornado-ioloop.patch
Added
@@ -0,0 +1,68 @@ +From 15b69a5c85dd5d96bbc664e4050379b847eeb13a Mon Sep 17 00:00:00 2001 +From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> +Date: Fri, 21 Nov 2014 22:39:56 +0100 +Subject: [PATCH 2/2] Upgrade the ZMQ output to run under a tornado ioloop + rather than polling + +--- + bonnie/dealer/outputs/zmq_output.py | 23 ++++++++++++----------- + 1 file changed, 12 insertions(+), 11 deletions(-) + +diff --git a/bonnie/dealer/outputs/zmq_output.py b/bonnie/dealer/outputs/zmq_output.py +index d5783ee..cd5b117 100644 +--- a/bonnie/dealer/outputs/zmq_output.py ++++ b/bonnie/dealer/outputs/zmq_output.py +@@ -23,6 +23,7 @@ + import os + import socket + import zmq ++from zmq.eventloop import ioloop, zmqstream + + import bonnie + conf = bonnie.getConf() +@@ -32,6 +33,8 @@ class ZMQOutput(object): + def __init__(self, *args, **kw): + self.context = zmq.Context() + ++ ioloop.install() ++ + zmq_broker_address = conf.get('dealer', 'zmq_broker_address') + + if zmq_broker_address == None: +@@ -41,8 +44,8 @@ class ZMQOutput(object): + self.dealer.identity = (u"Dealer-%s-%s" % (socket.getfqdn(), os.getpid())).encode('ascii') + self.dealer.connect(zmq_broker_address) + +- self.poller = zmq.Poller() +- self.poller.register(self.dealer, zmq.POLLIN) ++ self.dealer_stream = zmqstream.ZMQStream(self.dealer) ++ self.dealer_stream.on_recv(self.stop) + + def name(self): + return 'zmq_output' +@@ -54,15 +57,13 @@ class ZMQOutput(object): + log.debug("[%s] Notification received: %r" % (self.dealer.identity, notification), level=9) + self.dealer.send(notification) + +- received_reply = False +- while not received_reply: +- sockets = dict(self.poller.poll(1000)) +- if self.dealer in sockets: +- if sockets[self.dealer] == zmq.POLLIN: +- _reply = self.dealer.recv_multipart() +- log.debug("[%s] Reply: %r" % (self.dealer.identity, _reply), level=9) +- if _reply[0] == b"ACK": +- received_reply = True ++ ioloop.IOLoop.instance().start() ++ ++ def thanks(self, message *args, **kw): ++ cmd = message[0] ++ ++ if not cmd == b'ACL': ++ log.error("Unknown cmd %s" % (cmd)) + + self.dealer.close() + self.context.term() +-- +1.9.3 +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.