Browse Source

Merge "Report queue window in status JSON."

changes/25/69025/1
Jenkins 8 years ago committed by Gerrit Code Review
parent
commit
b5a4a832b7
  1. 5
      tests/test_scheduler.py
  2. 4
      zuul/model.py
  3. 6
      zuul/scheduler.py

5
tests/test_scheduler.py

@ -2879,8 +2879,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'])

4
zuul/model.py

@ -254,6 +254,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:
@ -313,6 +315,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:
@ -686,6 +689,7 @@ class QueueItem(object):
self.enqueue_time = None
self.dequeue_time = None
self.reported = False
self.active = False
def __repr__(self):
if self.pipeline:

6
zuul/scheduler.py

@ -1135,6 +1135,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)
@ -1153,11 +1155,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…
Cancel
Save