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.
Last active
September 7, 2016 14:47
-
-
Save hughsaunders/a56141fe7e0092b01f4356fdb0c44635 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment