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
diff --git a/etc/status/public_html/status-basic.json-sample b/etc/status/public_html/status-basic.json-sample
index 4e12cd6..9ee6d25 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 5d16bdd..8012420 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 61a786f..8f4d48f 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -132,6 +132,7 @@
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 @@
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 @@
ret += ', queue length: %s' % self.trigger_event_queue.qsize()
ret += '</p>'
+ if self.last_reconfigured:
+ ret += '<p>Last reconfigured: %s</p>' % self.last_reconfigured
+
keys = self.layout.pipelines.keys()
for key in keys:
pipeline = self.layout.pipelines[key]
@@ -788,6 +793,9 @@
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()