summaryrefslogtreecommitdiff
path: root/zuul/nodepool.py
diff options
context:
space:
mode:
authorJames E. Blair <jeblair@redhat.com>2018-09-27 12:50:15 -0700
committerClark Boylan <clark.boylan@gmail.com>2018-10-15 16:24:40 -0700
commitf080776c1de041fca8ea8b4695a1319bc70bdb5d (patch)
tree058f2323e1a0768ef62ccbacd5f32cb6bda502a6 /zuul/nodepool.py
parent824ca389b8a8f5b47c0f3fe7ea27cf2b1aabf657 (diff)
downloadzuul-f080776c1de041fca8ea8b4695a1319bc70bdb5d.tar.gz
Provide some accounting of node usage in logs
It would be good to provide this information in other ways (e.g., statsd, SQL), but for now, try to at least emit some useful accounting information that can be collected from logs. Change-Id: Ic12d91940bdd4b5a81596627d7544015df5eba09
Diffstat (limited to 'zuul/nodepool.py')
-rw-r--r--zuul/nodepool.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/zuul/nodepool.py b/zuul/nodepool.py
index a8ffe4bfb..68f9629aa 100644
--- a/zuul/nodepool.py
+++ b/zuul/nodepool.py
@@ -120,8 +120,18 @@ class Nodepool(object):
node.state = model.STATE_IN_USE
self.sched.zk.storeNode(node)
- def returnNodeSet(self, nodeset):
+ def returnNodeSet(self, nodeset, build=None):
self.log.info("Returning nodeset %s" % (nodeset,))
+ if (build and build.start_time and build.end_time and
+ build.build_set and build.build_set.item and
+ build.build_set.item.change and
+ build.build_set.item.change.project):
+ duration = build.end_time - build.start_time
+ project = build.build_set.item.change.project
+ self.log.info("Nodeset %s with %s nodes was in use "
+ "for %s seconds for build %s for project %s",
+ nodeset, len(nodeset.nodes), duration, build,
+ project)
for node in nodeset.getNodes():
if node.lock is None:
self.log.error("Node %s is not locked" % (node,))