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
This commit is contained in:
Sergey Lukjanov 2013-12-24 03:36:39 +04:00
parent dda083b9fb
commit 5d0438d45f
3 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,5 @@
{
"last_reconfigured": 1389381756000,
"message": "Example error message",
"pipelines": [
{

View File

@ -1,4 +1,5 @@
{
"last_reconfigured": 1389381756000,
"pipelines": [
{
"name": "check",

View File

@ -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 += '</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 @@ 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()