Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Last active September 7, 2016 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hughsaunders/a56141fe7e0092b01f4356fdb0c44635 to your computer and use it in GitHub Desktop.
Save hughsaunders/a56141fe7e0092b01f4356fdb0c44635 to your computer and use it in GitHub Desktop.
Started by user blah
[Pipeline] parallel
[Pipeline] [a] { (Branch: a)
[Pipeline] [b] { (Branch: b)
[Pipeline] [c] { (Branch: c)
[Pipeline] [a] echo
[a] c
[Pipeline] }
[Pipeline] [b] echo
[b] c
[Pipeline] }
[Pipeline] [c] echo
[c] c
[Pipeline] }
[Pipeline] // parallel
[Pipeline] echo
a
[Pipeline] echo
b
[Pipeline] echo
c
[Pipeline] End of Pipeline
Finished: SUCCESS
def block = {
echo(it)
}
def streams = [:]
for (i in ['a', 'b', 'c']){
streams[i]=block.curry(i)
}
parallel streams
for (v in streams.values()){
v()
}

Why does the block get the same argument each time when run via parallel? (why does it print [a] c not [a] a ?) When looping over streams sequentially it can be seen that each block has the correct arg encapsulated. This is shown by a,b,c being printed by the last three echo statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment