Report queue window in status JSON.
In order to render queue window information nicely in status pages pass the window for each queue in the JSON status blob. Also, annotate each change in a queue with an active flag indicating whether or not it is currently within the window. Change-Id: Iccba9fb307f98a4fc145402ecd0a38f3d75b3253changes/92/68792/3
parent
27f3b26e8e
commit
af2476f5e3
|
@ -2781,8 +2781,13 @@ class TestScheduler(testtools.TestCase):
|
|||
status_jobs = set()
|
||||
for p in data['pipelines']:
|
||||
for q in p['change_queues']:
|
||||
if q['dependent']:
|
||||
self.assertEqual(q['window'], 20)
|
||||
else:
|
||||
self.assertEqual(q['window'], 0)
|
||||
for head in q['heads']:
|
||||
for change in head:
|
||||
self.assertTrue(change['active'])
|
||||
self.assertEqual(change['id'], '1,1')
|
||||
for job in change['jobs']:
|
||||
status_jobs.add(job['name'])
|
||||
|
|
|
@ -240,6 +240,8 @@ class Pipeline(object):
|
|||
j_queue = dict(name=queue.name)
|
||||
j_queues.append(j_queue)
|
||||
j_queue['heads'] = []
|
||||
j_queue['window'] = queue.window
|
||||
j_queue['dependent'] = queue.dependent
|
||||
|
||||
j_changes = []
|
||||
for e in queue.queue:
|
||||
|
@ -299,6 +301,7 @@ class Pipeline(object):
|
|||
def formatItemJSON(self, item):
|
||||
changeish = item.change
|
||||
ret = {}
|
||||
ret['active'] = item.active
|
||||
if hasattr(changeish, 'url') and changeish.url is not None:
|
||||
ret['url'] = changeish.url
|
||||
else:
|
||||
|
@ -672,6 +675,7 @@ class QueueItem(object):
|
|||
self.enqueue_time = None
|
||||
self.dequeue_time = None
|
||||
self.reported = False
|
||||
self.active = False
|
||||
|
||||
def __repr__(self):
|
||||
if self.pipeline:
|
||||
|
|
|
@ -1133,6 +1133,8 @@ class BasePipelineManager(object):
|
|||
pass
|
||||
return (True, nnfi)
|
||||
dep_item = self.getFailingDependentItem(item)
|
||||
actionable = change_queue.isActionable(item)
|
||||
item.active = actionable
|
||||
if dep_item:
|
||||
failing_reasons.append('a needed change is failing')
|
||||
self.cancelJobs(item, prime=False)
|
||||
|
@ -1151,11 +1153,11 @@ class BasePipelineManager(object):
|
|||
change_queue.moveItem(item, nnfi)
|
||||
changed = True
|
||||
self.cancelJobs(item)
|
||||
if change_queue.isActionable(item):
|
||||
if actionable:
|
||||
self.prepareRef(item)
|
||||
if item.current_build_set.unable_to_merge:
|
||||
failing_reasons.append("it has a merge conflict")
|
||||
if change_queue.isActionable(item) and self.launchJobs(item):
|
||||
if actionable and self.launchJobs(item):
|
||||
changed = True
|
||||
if self.pipeline.didAnyJobFail(item):
|
||||
failing_reasons.append("at least one job failed")
|
||||
|
|
Loading…
Reference in New Issue