Skip to content

Instantly share code, notes, and snippets.

@huguesfontenelle
Last active June 3, 2016 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huguesfontenelle/887cc0d8214b20dfd9b355d38ec044bf to your computer and use it in GitHub Desktop.
Save huguesfontenelle/887cc0d8214b20dfd9b355d38ec044bf to your computer and use it in GitHub Desktop.
class Util {
static def whois(def number) {
def subdir = ['one', 'two', 'three']
return subdir[number-1]
}
}
ch = Channel.from(1, 2, 3)
process parallel {
echo true
publishDir "$storage/${Util.whois(no)}", mode: 'copy'
input:
val(no) from ch
output:
file('*.txt') into parallel_out
script:
"""
echo "A_${no}" > A_${no}.txt
echo "B_${no}" > B_${no}.txt
"""
}
process join {
echo true
publishDir "$storage"
input:
file('*') from parallel_out.flatten().toList()
output:
file('*.txt') into join_out
script:
"""
cat A_1.txt A_2.txt A_3.txt > A_join.txt
cat B_1.txt B_2.txt B_3.txt > B_join.txt
"""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment