Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/203950
Change subject: Add 'brrd-run' entry-point ...................................................................... Add 'brrd-run' entry-point Allows brrd to be executed without installing the package. Change-Id: Iab5edf0b251668061e2bdc322a41d4d898023183 --- A brrd-run M brrd/logger.py 2 files changed, 36 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/software/brrd refs/changes/50/203950/1 diff --git a/brrd-run b/brrd-run new file mode 100755 index 0000000..789a6b7 --- /dev/null +++ b/brrd-run @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + launch-brrd + ~~~~~~~~~~~ + + Copyright 2015 Ori Livneh <[email protected]> + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +""" +import sys +reload(sys) +sys.setdefaultencoding('utf-8') + +from brrd.main import main +main(['logger', 'tcp://vanadium.eqiad.wmnet:8600', '/Users/ori/tmp/foo.rrd']) diff --git a/brrd/logger.py b/brrd/logger.py index 2c72e7f..cb8cd0b 100644 --- a/brrd/logger.py +++ b/brrd/logger.py @@ -94,15 +94,14 @@ self.log.info('Connecting to <%s>...', parsed_args.endpoint) - ctx = zmq.Context() - zsock = ctx.socket(zmq.SUB) - zsock.hwm = 3000 - zsock.linger = 0 - zsock.connect(parsed_args.endpoint) - zsock.subscribe = b'' + socket = zmq.Context().socket(zmq.SUB) + socket.connect(parsed_args.endpoint) + socket.set(zmq.LINGER, 0) + socket.set(zmq.SUBSCRIBE, b'') - for meta in iter(zsock.recv_json, ''): - if meta.get('schema') == 'NavigationTiming': + while 1: + meta = socket.recv_json() + if meta['schema'] == 'NavigationTiming': window.add(meta['timestamp'], meta['event']) - if not worker.is_alive() and now() - time_start >= WINDOW_SPAN: - worker.start() + if not worker.is_alive() and now() - time_start >= WINDOW_SPAN: + worker.start() -- To view, visit https://gerrit.wikimedia.org/r/203950 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iab5edf0b251668061e2bdc322a41d4d898023183 Gerrit-PatchSet: 1 Gerrit-Project: operations/software/brrd Gerrit-Branch: master Gerrit-Owner: Ori.livneh <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
