Merge "Don't request empty nodesets" into feature/zuulv3

changes/29/491129/2
Jenkins 5 years ago committed by Gerrit Code Review
commit 7f98f3132c
  1. 9
      tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
  2. 6
      tests/unit/test_scheduler.py
  3. 4
      zuul/executor/client.py
  4. 13
      zuul/nodepool.py

@ -43,6 +43,9 @@
- job:
name: project-merge
hold-following-changes: true
nodes:
- name: controller
label: label1
- job:
name: project-test1
@ -66,9 +69,15 @@
- job:
name: project-test2
nodes:
- name: controller
label: label1
- job:
name: project1-project2-integration
nodes:
- name: controller
label: label1
- job:
name: project-testfile

@ -62,7 +62,8 @@ class TestSchedulerSSL(SSLZuulTestCase):
self.assertEqual(A.reported, 2)
self.assertEqual(self.getJobFromHistory('project-test1').node,
'label1')
self.assertIsNone(self.getJobFromHistory('project-test2').node)
self.assertEqual(self.getJobFromHistory('project-test2').node,
'label1')
class TestScheduler(ZuulTestCase):
@ -85,7 +86,8 @@ class TestScheduler(ZuulTestCase):
self.assertEqual(A.reported, 2)
self.assertEqual(self.getJobFromHistory('project-test1').node,
'label1')
self.assertIsNone(self.getJobFromHistory('project-test2').node)
self.assertEqual(self.getJobFromHistory('project-test2').node,
'label1')
# TODOv3(jeblair): we may want to report stats by tenant (also?).
# Per-driver

@ -409,6 +409,10 @@ class ExecutorClient(object):
del self.builds[job.unique]
except:
pass
# Since this isn't otherwise going to get a build complete
# event, send one to the scheduler so that it can unlock
# the nodes.
self.sched.onBuildCompleted(build, 'CANCELED', {})
return True
return False

@ -29,10 +29,15 @@ class Nodepool(object):
req = model.NodeRequest(self.sched.hostname, build_set, job, nodeset)
self.requests[req.uid] = req
self.sched.zk.submitNodeRequest(req, self._updateNodeRequest)
# Logged after submission so that we have the request id
self.log.info("Submited node request %s" % (req,))
if nodeset.nodes:
self.sched.zk.submitNodeRequest(req, self._updateNodeRequest)
# Logged after submission so that we have the request id
self.log.info("Submited node request %s" % (req,))
else:
self.log.info("Fulfilling empty node request %s" % (req,))
req.state = model.STATE_FULFILLED
self.sched.onNodesProvisioned(req)
del self.requests[req.uid]
return req
def cancelRequest(self, request):

Loading…
Cancel
Save