Add global scheduling on module triggers
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 17 Jul 2015 20:43:58 +0000 (16:43 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 17 Jul 2015 20:43:58 +0000 (16:43 -0400)
dsl/kernel-lttng-modules.seed.groovy

index 0e2fa4dcbd0f6e6797253b742673c77cefeb7cb3..049ce6824e82728b113396602b40b542787dafae 100644 (file)
@@ -331,6 +331,7 @@ def fail = false
 def jobStartWith = "JOBPREFIX"
 def toBuild = []
 def counter = 0
+def limitQueue = 4
 
 def anotherBuild
 jobs.each { job ->
@@ -350,8 +351,17 @@ hudson.model.Hudson.instance.nodes.each { node ->
 }
 
 def ongoingBuild = []
+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.Look for both kernel and downstream module from previous kernel.
+       def queuedTask = q.getItems().findAll {
+               it.task.getParent().name.startsWith(jobStartWithKernel) ||
+                 it.task.getParent().name.startsWith(jobStartWithModule)
+       }
+       
+       if ((ongoingBuild.size() <= kernelEnabledNode.intdiv(2)) && (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.023825 seconds and 4 git commands to generate.