Test queue based queuing
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 16 Jul 2015 15:42:52 +0000 (11:42 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 16 Jul 2015 15:44:45 +0000 (11:44 -0400)
dsl/kernel-lttng-modules.seed.groovy

index 86bf76d4e41fe37c78979ea725ad218d0b5e6c61..9745224828faddd86b091d0a7772c9b06c14ce0f 100644 (file)
@@ -261,6 +261,7 @@ def fail = false
 def jobStartWith = "dsl-kernel-"
 def toBuild = []
 def counter = 0
+def limitQueue = 4
 
 def anotherBuild
 jobs.each { job ->
@@ -289,11 +290,14 @@ hudson.model.Hudson.instance.nodes.each { node ->
 println "Nb of live kernel enabled build node "+ kernelEnabledNode
 
 def ongoingBuild = []
-def q = jenkins.model.Jenkins.getInstance().getQueue()
+def q = jenkins.model.Jenkins.getInstance().getQueue() 
 
 
 while (toBuild.size() != 0) {
-       if(ongoingBuild.size() <= (kernelEnabledNode.intdiv(2))) {
+       // Throttle the build with both the number of current parent task and queued
+       // task.
+       def queuedTask = q.getItems().findAll { it.task.name.startsWith(jobStartWith) }
+       if ((ongoingBuild.size() <= kernelEnabledNode) && (queuedTask.size() < limitQueue)) {
                def job = toBuild.pop()
                ongoingBuild.push(job.scheduleBuild2(0))
                println "\\t trigering" + HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName)
This page took 0.024136 seconds and 4 git commands to generate.