start jenkins sub jobs parallelly

311 views
Skip to first unread message

pb60704

unread,
Jul 15, 2016, 12:19:50 PM7/15/16
to jenkins...@googlegroups.com
I have 'n' no. of jobs, which I want to start simultaneously. Is it feasible
in Jenkins? I tried using DSL plugin, work flow plugin. I have used
'parallel' method. I have my list of jobnames in an array/list and want to
run them parallel. Please help.

Currently I'm iterating the jobnames in a for loop,they start one by one,
instead I want them to start parallel. How this can be achieved ?




--
View this message in context: http://jenkins-ci.361315.n4.nabble.com/start-jenkins-sub-jobs-parallelly-tp4827908.html
Sent from the Jenkins users mailing list archive at Nabble.com.

Ginga, Dick

unread,
Jul 15, 2016, 12:41:11 PM7/15/16
to jenkins...@googlegroups.com
If you actually want them to start at the same moment (roughly), and they are all separate jobs, check Build Periodically and enter exactly the same time.

e.g. 10 10 * * *

this says run at 10:10 AM every day

-----Original Message-----
From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of pb60704
Sent: Friday, July 15, 2016 4:39 AM
To: jenkins...@googlegroups.com
Subject: start jenkins sub jobs parallelly

I have 'n' no. of jobs, which I want to start simultaneously. Is it feasible in Jenkins? I tried using DSL plugin, work flow plugin. I have used 'parallel' method. I have my list of jobnames in an array/list and want to run them parallel. Please help.

Currently I'm iterating the jobnames in a for loop,they start one by one, instead I want them to start parallel. How this can be achieved ?




--
View this message in context: https://urldefense.proofpoint.com/v2/url?u=http-3A__jenkins-2Dci.361315.n4.nabble.com_start-2Djenkins-2Dsub-2Djobs-2Dparallelly-2Dtp4827908.html&d=CwIBaQ&c=3mGIBQKb1eS1YDHb7ax3kFkT2UAGBJ12p2lcECIjhXk&r=SXz9subj7EUWDFIuiAjJSXBLM9pAzGIduhHWvfq5re0&m=emlwH7z__pPgl-6w-cQMYspM25h6FZ8B-7IhpJU3sb0&s=-DZJHt8jzKvGYjAeL3WaaVrUblrS-m48-j2XDBiT9fw&e=
Sent from the Jenkins users mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_jenkinsci-2Dusers_1468571936370-2D4827908.post-2540n4.nabble.com&d=CwIBaQ&c=3mGIBQKb1eS1YDHb7ax3kFkT2UAGBJ12p2lcECIjhXk&r=SXz9subj7EUWDFIuiAjJSXBLM9pAzGIduhHWvfq5re0&m=emlwH7z__pPgl-6w-cQMYspM25h6FZ8B-7IhpJU3sb0&s=_XwcrRgONx0shJfThf7AnFDTz6YtpjzJaR_4U43UPqw&e= .
For more options, visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=CwIBaQ&c=3mGIBQKb1eS1YDHb7ax3kFkT2UAGBJ12p2lcECIjhXk&r=SXz9subj7EUWDFIuiAjJSXBLM9pAzGIduhHWvfq5re0&m=emlwH7z__pPgl-6w-cQMYspM25h6FZ8B-7IhpJU3sb0&s=wcoK1D40nss5eqWvT8-A8zJDSLsigV6LrLdXh5UwjtQ&e= .

Wayne Warren

unread,
Jul 18, 2016, 11:34:57 AM7/18/16
to Jenkins Users
There are a couple different ways I would do this but the simplest would be to have a single job that triggers automatically whose primary function is to trigger all the jobs you want running in parallel as downstream of itself.

Another way would be to have this "trigger" job make use of the MultiJob Plugin, in which case you can pretty easily stage the execution of multiple sets of parallel jobs. The advantage of this plugin, even if you don't want to separate your parallel job runs into multiple stages is that the success of the job doing the triggering can depend on the success of the triggered jobs, so you have one job's status to check for overall success/failure.

However, I am still learning about the Pipeline (aka Workflow) Plugin and there may very well be a better way to express the parallel behavior you are looking for using it. The misleadingly-named "parallel" keyword is probably not it though... Here's an example of how it works: https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/parallel-from-list/parallelFromList.groovy#L27 You might be able to use this in combination with the pipeline-build-step step: https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job

pb60704

unread,
Jul 26, 2016, 3:37:37 PM7/26/16
to jenkins...@googlegroups.com
I tried the below code, but that doesn't ensure the parallel run.

#!groovy
stage "preparation"


node {
parallel (
phase1: {
echo "phase1"
},
phase2: {
echo "phase2"
}
)
}


stage "do the build"



parallel (

"stream 1" : {

node {
def now = new Date()
def timestampNow = now.toTimestamp()
println "Start: ${timestampNow}
[${timestampNow.class}]"
echo "hstream1"
}
},

"stream 2" : {

node {
def now = new Date()
def timestampNow = now.toTimestamp()
println "Start: ${timestampNow}
[${timestampNow.class}]"
echo "hashtag fail"
}
}

)



--
View this message in context: http://jenkins-ci.361315.n4.nabble.com/start-jenkins-sub-jobs-parallelly-tp4827908p4828292.html
Reply all
Reply to author
Forward
0 new messages