From: Jonathan Rajotte Date: Fri, 17 Jul 2015 20:43:58 +0000 (-0400) Subject: Add global scheduling on module triggers X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6776fe0b8f0d5695343e4f3cc8a165fcdd614038;p=lttng-ci.git Add global scheduling on module triggers --- diff --git a/dsl/kernel-lttng-modules.seed.groovy b/dsl/kernel-lttng-modules.seed.groovy index 0e2fa4d..049ce68 100644 --- a/dsl/kernel-lttng-modules.seed.groovy +++ b/dsl/kernel-lttng-modules.seed.groovy @@ -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)