println "Nb of live kernel enabled build node "+ kernelEnabledNode
def ongoingBuild = []
+def queueInstance = Jenkins.instance.queue
+
while (toBuild.size() != 0) {
if(ongoingBuild.size() <= (kernelEnabledNode.intdiv(2))) {
def job = toBuild.pop()
ongoingBuild.push(job.scheduleBuild2(0))
println "\\t trigering" + HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName)
+ println "Debug: currenlty queued task" + queueInstance.items.size()
} else {
Thread.sleep(random.nextInt(120000))
ongoingBuild.removeAll{ it.isCancelled() || it.isDone() }