Projects
Kolab:3.4
bonnie
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 34
View file
bonnie.spec
Changed
@@ -17,7 +17,7 @@ %global bonnie_group_id 415 Name: bonnie -Version: 0.1.2 +Version: 0.1.3 Release: 1%{?dist} Summary: Bonnie for Kolab Groupware @@ -26,9 +26,6 @@ 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 @@ -117,9 +114,6 @@ %prep %setup -q -%patch0001 -p1 -%patch0002 -p1 - %build %install
View file
0001-Fork-the-dealer-process-to-the-background-at-the-ear.patch
Deleted
@@ -1,36 +0,0 @@ -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
Deleted
@@ -1,68 +0,0 @@ -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 stop(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 -
View file
bonnie-0.1.2.tar.gz/bonnie/dealer/__init__.py -> bonnie-0.1.3.tar.gz/bonnie/dealer/__init__.py
Changed
@@ -74,8 +74,9 @@ def run(self, notification): if self.accept_notification(notification): output_modules = conf.get('dealer', 'output_modules') + output_modules = [x.strip() for x in output_modules.split(',')] for _output in self.output_modules.keys(): - if _output.name() == output_modules: + if _output.name() in output_modules: _output.run(notification) else: log.info("Ignoring notification %s", notification)
View file
bonnie-0.1.2.tar.gz/bonnie/dealer/outputs/zmq_output.py -> bonnie-0.1.3.tar.gz/bonnie/dealer/outputs/zmq_output.py
Changed
@@ -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 @@ 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 @@ 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,15 @@ 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 stop(self, message, *args, **kw): + cmd = message[0] + + if not cmd == b'ACK': + log.error("Unknown cmd %s" % (cmd)) + + ioloop.IOLoop.instance().stop() self.dealer.close() self.context.term()
View file
bonnie-0.1.2.tar.gz/dealer.py -> bonnie-0.1.3.tar.gz/dealer.py
Changed
@@ -1,6 +1,7 @@ #!/usr/bin/python import json +import os import sys from bonnie.dealer import BonnieDealer @@ -8,5 +9,8 @@ if __name__ == "__main__": notification = sys.stdin.read().strip() - dealer = BonnieDealer() - dealer.run(notification) + newpid = os.fork() + + if newpid == 0: + dealer = BonnieDealer() + dealer.run(notification)
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
.