-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
61 lines (49 loc) · 1.51 KB
/
main.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env nextflow
project_dir = projectDir
//Run this script to notify the platform that task execution has started
def startProc = "${project_dir}/started.sh".execute()
process writeToFile {
executor = 'local'
// maxForks = 1
input:
file 'input'
script:
"""
cat ${input} > ${projectDir}/output/output.json
"""
}
process demo {
executor = 'local'
// maxForks = 1
output:
stdout
script:
"""
source ${project_dir}/venv/bin/activate && python ${projectDir}/demo.py ${project_dir}
"""
}
workflow {
demo | writeToFile
}
workflow.onComplete {
println "Pipeline completed at: $workflow.complete"
println "Execution status: ${ workflow.success ? 'OK' : 'failed' }"
f = new File("${projectDir}/status.txt")
f.append("\nPipeline completed at: $workflow.complete")
f.append("\nExecution status: ${ workflow.success ? 'OK' : 'failed' }")
def proc = "${project_dir}/completed.sh".execute()
def b = new StringBuffer()
proc.consumeProcessErrorStream(b)
println proc.text
println b.toString()
}
workflow.onError {
println "Error: Pipeline execution stopped with the following message: ${workflow.errorMessage}"
f = new File("${projectDir}/status.txt")
f.append("\nError: Pipeline execution stopped with the following message: ${workflow.errorMessage}")
def proc = "${project_dir}/failed.sh".execute()
def b = new StringBuffer()
proc.consumeProcessErrorStream(b)
println proc.text
println b.toString()
}