From 1511bc38a334418cbb0707f5e007fff4361a31a7 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 18 Jan 2017 09:25:31 -0800 Subject: [PATCH] Spell NodeSet consistently It is intended to match the existing pattern used by BuildSet. Usage is currently evenly split between NodeSet and Nodeset. Change-Id: Iab96ed90a9ada0cb4709c0bb8b04923ab0c765e8 --- tests/test_nodepool.py | 4 ++-- zuul/manager/__init__.py | 8 ++++---- zuul/nodepool.py | 12 ++++++------ zuul/scheduler.py | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/test_nodepool.py b/tests/test_nodepool.py index f422de7aa1..6462f9af98 100644 --- a/tests/test_nodepool.py +++ b/tests/test_nodepool.py @@ -79,12 +79,12 @@ class TestNodepool(BaseTestCase): self.assertEqual(node.state, 'ready') # Mark the nodes in use - self.nodepool.useNodeset(nodeset) + self.nodepool.useNodeSet(nodeset) for node in nodeset.getNodes(): self.assertEqual(node.state, 'in-use') # Return the nodes - self.nodepool.returnNodeset(nodeset) + self.nodepool.returnNodeSet(nodeset) for node in nodeset.getNodes(): self.assertIsNone(node.lock) self.assertEqual(node.state, 'used') diff --git a/zuul/manager/__init__.py b/zuul/manager/__init__.py index 988a9306df..75339efc56 100644 --- a/zuul/manager/__init__.py +++ b/zuul/manager/__init__.py @@ -365,7 +365,7 @@ class PipelineManager(object): self.log.debug("Found job %s for change %s" % (job, item.change)) try: nodeset = item.current_build_set.getJobNodeSet(job.name) - self.sched.nodepool.useNodeset(nodeset) + self.sched.nodepool.useNodeSet(nodeset) build = self.sched.launcher.launch(job, item, self.pipeline, dependent_items) @@ -406,7 +406,7 @@ class PipelineManager(object): if not was_running: try: nodeset = build.build_set.getJobNodeSet(build.job.name) - self.sched.nodepool.returnNodeset(nodeset) + self.sched.nodepool.returnNodeSet(nodeset) except Exception: self.log.exception("Unable to return nodeset %s for " "canceled build request %s" % @@ -417,7 +417,7 @@ class PipelineManager(object): for jobname, nodeset in old_build_set.nodesets.items()[:]: if jobname in canceled_jobs: continue - self.sched.nodepool.returnNodeset(nodeset) + self.sched.nodepool.returnNodeSet(nodeset) for item_behind in item.items_behind: self.log.debug("Canceling jobs for change %s, behind change %s" % (item_behind.change, item.change)) @@ -623,7 +623,7 @@ class PipelineManager(object): for build in build.build_set.getBuilds(): if build.result == 'SKIPPED': nodeset = build.build_set.getJobNodeSet(build.job.name) - self.sched.nodepool.returnNodeset(nodeset) + self.sched.nodepool.returnNodeSet(nodeset) return True diff --git a/zuul/nodepool.py b/zuul/nodepool.py index 8c944cce86..d116a2bc9e 100644 --- a/zuul/nodepool.py +++ b/zuul/nodepool.py @@ -44,7 +44,7 @@ class Nodepool(object): self.log.exception("Error deleting node request:") del self.requests[request.uid] - def useNodeset(self, nodeset): + def useNodeSet(self, nodeset): self.log.info("Setting nodeset %s in use" % (nodeset,)) for node in nodeset.getNodes(): if node.lock is None: @@ -52,7 +52,7 @@ class Nodepool(object): node.state = model.STATE_IN_USE self.sched.zk.storeNode(node) - def returnNodeset(self, nodeset): + def returnNodeSet(self, nodeset): self.log.info("Returning nodeset %s" % (nodeset,)) for node in nodeset.getNodes(): if node.lock is None: @@ -62,7 +62,7 @@ class Nodepool(object): self.sched.zk.storeNode(node) self._unlockNodes(nodeset.getNodes()) - def unlockNodeset(self, nodeset): + def unlockNodeSet(self, nodeset): self._unlockNodes(nodeset.getNodes()) def _unlockNodes(self, nodes): @@ -72,7 +72,7 @@ class Nodepool(object): except Exception: self.log.exception("Error unlocking node:") - def lockNodeset(self, nodeset): + def lockNodeSet(self, nodeset): self._lockNodes(nodeset.getNodes()) def _lockNodes(self, nodes): @@ -123,7 +123,7 @@ class Nodepool(object): if request.fulfilled: # If the request suceeded, try to lock the nodes. try: - self.lockNodeset(request.nodeset) + self.lockNodeSet(request.nodeset) locked = True except Exception: self.log.exception("Error locking nodes:") @@ -141,4 +141,4 @@ class Nodepool(object): # nodes, unlock the nodes since we're not going to use # them. if locked: - self.unlockNodeset(request.nodeset) + self.unlockNodeSet(request.nodeset) diff --git a/zuul/scheduler.py b/zuul/scheduler.py index 5e49f205e4..f53c93ce0d 100644 --- a/zuul/scheduler.py +++ b/zuul/scheduler.py @@ -773,7 +773,7 @@ class Scheduler(threading.Thread): # the nodes to nodepool. try: nodeset = build.build_set.getJobNodeSet(build.job.name) - self.nodepool.returnNodeset(nodeset) + self.nodepool.returnNodeSet(nodeset) except Exception: self.log.exception("Unable to return nodeset %s" % (nodeset,)) @@ -816,14 +816,14 @@ class Scheduler(threading.Thread): if build_set is not build_set.item.current_build_set: self.log.warning("Build set %s is not current" % (build_set,)) if request.fulfilled: - self.nodepool.returnNodeset(request.nodeset) + self.nodepool.returnNodeSet(request.nodeset) return pipeline = build_set.item.pipeline if not pipeline: self.log.warning("Build set %s is not associated with a pipeline" % (build_set,)) if request.fulfilled: - self.nodepool.returnNodeset(request.nodeset) + self.nodepool.returnNodeSet(request.nodeset) return pipeline.manager.onNodesProvisioned(event)