From 2af754d4241438bd7c73c70f8f1a520f6a27da13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Albert?= Date: Mon, 11 May 2015 17:36:08 +0200 Subject: [PATCH] Fixed collector unhandled exception management Change-Id: I558168a2ac29e8252d8f12b78777391739942855 --- cloudkitty/orchestrator.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cloudkitty/orchestrator.py b/cloudkitty/orchestrator.py index 783034fa..51aa14b2 100644 --- a/cloudkitty/orchestrator.py +++ b/cloudkitty/orchestrator.py @@ -178,17 +178,21 @@ class Worker(BaseWorker): for service in CONF.collect.services: try: - data = self._collect(service, timestamp) + try: + data = self._collect(service, timestamp) + except collector.NoDataCollected: + raise + except Exception as e: + LOG.warn('Error while collecting service {service}:' + ' {error}'.format(service=service, + error=str(e))) + raise collector.NoDataCollected('', service) except collector.NoDataCollected: begin = timestamp end = begin + self._period for processor in self._processors: processor.obj.nodata(begin, end) self._storage.nodata(begin, end, self._tenant_id) - except Exception as e: - LOG.warn('Error while collecting service {service}:' - ' {error}'.format(service=service, - error=str(e))) else: # Rating for processor in self._processors: