From 5d0438d45fd7e7cfb09c84f5000cb493b9c90e7a Mon Sep 17 00:00:00 2001 From: Sergey Lukjanov Date: Tue, 24 Dec 2013 03:36:39 +0400 Subject: [PATCH] Collect and report last reconfigured timestamp * ms timestamp collected each time Scheduler.reconfigure() completed * last reconfigured timestamp reported through the status.json * it could be useful to determine when zuul conf reloaded Change-Id: I03c5a5734f2127ef40be9ec512c983b136508be7 --- etc/status/public_html/status-basic.json-sample | 1 + etc/status/public_html/status-openstack.json-sample | 1 + zuul/scheduler.py | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/etc/status/public_html/status-basic.json-sample b/etc/status/public_html/status-basic.json-sample index 4e12cd6497..9ee6d25abf 100644 --- a/etc/status/public_html/status-basic.json-sample +++ b/etc/status/public_html/status-basic.json-sample @@ -1,4 +1,5 @@ { + "last_reconfigured": 1389381756000, "message": "Example error message", "pipelines": [ { diff --git a/etc/status/public_html/status-openstack.json-sample b/etc/status/public_html/status-openstack.json-sample index 5d16bdd269..8012420631 100644 --- a/etc/status/public_html/status-openstack.json-sample +++ b/etc/status/public_html/status-openstack.json-sample @@ -1,4 +1,5 @@ { + "last_reconfigured": 1389381756000, "pipelines": [ { "name": "check", diff --git a/zuul/scheduler.py b/zuul/scheduler.py index 61a786fc7c..8f4d48fe30 100644 --- a/zuul/scheduler.py +++ b/zuul/scheduler.py @@ -132,6 +132,7 @@ class Scheduler(threading.Thread): self.layout = model.Layout() self.zuul_version = zuul_version.version_info.version_string() + self.last_reconfigured = None def stop(self): self._stopped = True @@ -445,6 +446,7 @@ class Scheduler(threading.Thread): self.log.debug("Waiting for reconfiguration") event.wait() self.log.debug("Reconfiguration complete") + self.last_reconfigured = int(time.time()) def promote(self, pipeline_name, change_ids): event = PromoteEvent(pipeline_name, change_ids) @@ -757,6 +759,9 @@ class Scheduler(threading.Thread): ret += ', queue length: %s' % self.trigger_event_queue.qsize() ret += '

' + if self.last_reconfigured: + ret += '

Last reconfigured: %s

' % self.last_reconfigured + keys = self.layout.pipelines.keys() for key in keys: pipeline = self.layout.pipelines[key] @@ -788,6 +793,9 @@ class Scheduler(threading.Thread): data['result_event_queue']['length'] = \ self.result_event_queue.qsize() + if self.last_reconfigured: + data['last_reconfigured'] = self.last_reconfigured * 1000 + pipelines = [] data['pipelines'] = pipelines keys = self.layout.pipelines.keys()