From e5fbd6ca4837f814455185fd11cf32c92cbe6ed2 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 18 Jul 2014 08:26:52 -0400 Subject: [PATCH] Add subunit2sql gearman workers This adds a new gearman worker to process the subunit files from the gate job runs. It will use subunit2sql to connect to a sql server and process the data from the subunit file. The log-gearman-client is modified to allow for pushing subunit jobs to gearman, and the worker model for processsing logs is borrowed to process the subunit files. Change-Id: I83103eb6afc22d91f916583c36c0e956c23a64b3 --- files/log-gearman-client.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/files/log-gearman-client.py b/files/log-gearman-client.py index e9d8383..e699796 100644 --- a/files/log-gearman-client.py +++ b/files/log-gearman-client.py @@ -75,7 +75,11 @@ class EventProcessor(threading.Thread): output['source_url'] = source_url output['retry'] = fileopts.get('retry-get', False) output['event'] = out_event - job = gear.Job(b'push-log', json.dumps(output).encode('utf8')) + if 'subunit' in fileopts.get('name'): + job = gear.Job(b'push-subunit', + json.dumps(output).encode('utf8')) + else: + job = gear.Job(b'push-log', json.dumps(output).encode('utf8')) try: self.gearman_client.submitJob(job) except: @@ -146,10 +150,14 @@ class Server(object): gearclient = gear.Client() gearclient.addServer('localhost') gearclient.waitForServer() - processor = EventProcessor( + log_processor = EventProcessor( publisher, gearclient, self.config['source-files'], self.source_url) - self.processors.append(processor) + subunit_processor = EventProcessor( + publisher, gearclient, + self.config['subunit-files'], self.source_url) + self.processors.append(log_processor) + self.processors.append(subunit_processor) def main(self): statsd_host = os.environ.get('STATSD_HOST')