Hi,
I was having the same issue. Surprisingly, when you use c-style loop with
index, it works. Something like this:
for ( pindex = 0; pindex < pkgs.size(); pindex++ ) {
for ( bindex = 0; bindex < build_machines.size(); bindex++ ) {
bmachine = build_machines[bindex]
def pkg = pkgs[pindex].trim()
branches["${bmachine}-${pkg}"] = {
node("${bmachine}") {
//do something
}
}
}
}
Please let me know, if this worked for you.
On Wed, May 27, 2015 at 9:02 AM, Angelo Cuttitta <[email protected]>
wrote:
> Dear,
>
>
> I'm facing to the same kind of issue, trying to run multiple jobs in
> parallel.
> Hence, unfortunately, I can't help you... :-(
>
> I was just wondering if you found a solution, since you posted your
> message?
>
> Kr,
> A.
>
> Le mardi 31 mars 2015 21:58:27 UTC+2, Adam R. Paul a écrit :
>
>> Hello,
>>
>> I'm working on my first workflow job, using Jenkins LTS 1.596.2 &
>> workflow 1.4, and am getting the following error:
>>
>> [...]
>> Running: Execute sub-workflows in parallel : Body : End
>> Running: End of Workflow
>> java.io.NotSerializableException: java.util.HashMap$Entry
>> [...]
>>
>> I confess I am not yet fluent in groovy, and only passingly familiar
>> with java, so this may be something simple/stupid, but googling around
>> didn't show anything that seemed applicable.
>>
>> The relevant except of my workflow is:
>>
>> """
>> def bport_cmds = [:]
>>
>> // first determine the RTIs/bugs to backport:
>> node ("gates") {
>> runscript("01_gen_buglist -s ${SCRIPT_HOME}/../not-in-sru-bugs -u
>> ${SCRIPT_HOME}/../in-update-bugs")
>> def j = readFile("build.params")
>> //echo j.toString()
>> def rti = new JsonSlurper().parseText(j.toString())
>>
>> // populate map of backport commands to run in parallel
>> for (Map.Entry<String, List> entry : rti.entrySet()) {
>> def script = "02_do_backports -r " + entry.getKey() + " -b "
>> def cnt = 0
>> for (bug in entry.getValue()) {
>> if (cnt == 0) {
>> script += bug
>> } else {
>> script += "," + bug
>> }
>> cnt++
>> }
>> bport_cmds[entry.getKey()] = { echo "Would have run " + script }
>> }
>> rti = null
>> }
>>
>> echo bport_cmds.toString()
>>
>> // run the backports in parallel:
>> parallel bport_cmds
>> bport_cmds = null
>> """
>>
>> Before adding the parallel call, everything works as expected.
>>
>> Any ideas?
>>
>> The <redacted> console output is:
>>
>> """
>> Started by user anonymous
>> Running: Allocate node : Start
>> Running on <host> in <dir>
>> Running: Allocate node : Body : Start
>> Running: Shell Script
>> <01_genbuglist script output>
>> Running: Read file from workspace
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: Print Message
>> [403412:com.cloudbees.groovy.cps.impl.CpsClosure@3d839d,
>> 403850:com.cloudbees.groovy.cps.impl.CpsClosure@1bf9ea2,
>> 402337:com.cloudbees.groovy.cps.impl.CpsClosure@147a2ae]
>> Running: Execute sub-workflows in parallel : Start
>> [403412] Running: Parallel branch: 403412
>> [403850] Running: Parallel branch: 403850
>> [402337] Running: Parallel branch: 402337
>> [403412] Running: Print Message
>> [403412] Would have run 02_do_backports -r 403412 -b 19320107
>> Running: Execute sub-workflows in parallel : Body : End
>> [403850] Running: Print Message
>> [403850] Would have run 02_do_backports -r 403850 -b 19863042,19404161
>> Running: Execute sub-workflows in parallel : Body : End
>> [402337] Running: Print Message
>> [402337] Would have run 02_do_backports -r 402337 -b 17500325
>> Running: Execute sub-workflows in parallel : Body : End
>> Running: End of Workflow
>> java.io.NotSerializableException: java.util.HashMap$Entry
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>>
>> at
>> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>>
>> at
>> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>>
>> at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)
>> at java.util.HashMap.writeObject(HashMap.java:1129)
>> at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>
>> at java.lang.reflect.Method.invoke(Method.java:606)
>> at
>> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>>
>> at
>> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>>
>> at
>> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>>
>> at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)
>> at java.util.HashMap.writeObject(HashMap.java:1129)
>> at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>
>> at java.lang.reflect.Method.invoke(Method.java:606)
>> at
>> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>>
>> at
>> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>>
>> at
>> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>>
>> at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)
>> at java.util.HashMap.writeObject(HashMap.java:1129)
>> at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>
>> at java.lang.reflect.Method.invoke(Method.java:606)
>> at
>> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>>
>> at
>> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>>
>> at
>> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>>
>> at
>> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>>
>> at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)
>> at java.util.HashMap.writeObject(HashMap.java:1129)
>> at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>
>> at java.lang.reflect.Method.invoke(Method.java:606)
>> at
>> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>>
>> at
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>>
>> at
>> org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
>>
>> at
>> org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
>>
>> at
>> org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:133)
>>
>> at
>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:341)
>>
>> at
>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:325)
>>
>> at
>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:300)
>>
>> at
>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71)
>>
>> at
>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:177)
>>
>> at
>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:175)
>>
>> at
>> org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
>>
>> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>> at
>> hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:111)
>>
>> at
>> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
>>
>> at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>
>> at java.lang.Thread.run(Thread.java:745)
>> Caused by: an exception which occurred:
>> in field locals
>> in field parent
>> in field capture
>> in field def
>> in field locals
>> in field capture
>> in field def
>> in field delegate
>> in field closures
>> in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@4622d3
>> Finished: FAILURE
>> """
>>
>> Thanks!
>> Adam
>>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/bf752fcb-ce30-4bdc-acb2-cee8ab9ec715%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/bf752fcb-ce30-4bdc-acb2-cee8ab9ec715%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CADBOz-irJzR%3Dry_dEeJoExCcCNhH9-B11Upg3q%3DFeA%3Dp6rbe%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.