-
Notifications
You must be signed in to change notification settings - Fork 0
/
processes.nf
169 lines (144 loc) · 4.3 KB
/
processes.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
process run_abaqus {
label 'abaqus_job'
errorStrategy 'finish'
publishDir "output", mode: 'copy'
input:
path inputfile_template
path node_file
path element_file
val cof
val coretype_code
val corecount
output:
path '*.odb', emit: odb
path '*', emit: restartfiles
script:
"""
create_tag() {
local text="\$1"
curl -H "Authorization: Token \${RESCALE_API_KEY}" -H "Content-Type: application/json" "\${RESCALE_API_BASE_URL}/api/v2/jobs/\${RESCALE_JOB_ID}/tags/" -X POST -d "{ \\"name\\": \\"\${text}\\" }"
}
create_tag "Computational_Pipeline"
runname=\$(basename "${workflow.projectDir}")
create_tag "Study:\${runname}"
create_tag "cof:${cof}"
template_base=\$(basename "$inputfile_template" .inp)
jobname="\${template_base}_${cof}"
inputfile="\${jobname}.inp"
cp $inputfile_template \$inputfile
sed -i 's/<cof>/$cof/g' \$inputfile
abaqus job=\$jobname cpus=\$RESCALE_CORES_PER_SLOT mp_mode=mpi interactive
"""
stub:
"""
template_base=\$(basename "$inputfile_template" .inp)
jobname="\${template_base}_${cof}"
echo "running abaqus"
echo "#test" > \${jobname}.dat
echo "#test" > \${jobname}.msg
echo "#test" > \${jobname}.odb
echo "#test" > \${jobname}.res
"""
}
process run_abaqus_restart {
label 'abaqus_job'
errorStrategy 'finish'
publishDir "output", mode: 'copy'
input:
path inputfile_template
path node_file
path element_file
val cof
path restartfiles
val coretype_code
val corecount
output:
path '*.odb', emit: odb
path '*', emit: restartfiles
script:
"""
create_tag() {
local text="\$1"
curl -H "Authorization: Token \${RESCALE_API_KEY}" -H "Content-Type: application/json" "\${RESCALE_API_BASE_URL}/api/v2/jobs/\${RESCALE_JOB_ID}/tags/" -X POST -d "{ \\"name\\": \\"\${text}\\" }"
}
create_tag "Computational_Pipeline"
runname=\$(basename "${workflow.projectDir}")
create_tag "Study:\${runname}"
create_tag "cof:${cof}"
template_base=\$(basename "$inputfile_template" .inp)
jobname="\${template_base}_${cof}"
inputfile="\${jobname}.inp"
restartfiles_array=($restartfiles)
first_restartfile=\${restartfiles_array[0]}
oldjobname="\${first_restartfile%.*}"
cp $inputfile_template \$inputfile
sed -i 's/<cof>/$cof/g' \$inputfile
abaqus job=\$jobname oldjob=\$oldjobname cpus=\$RESCALE_CORES_PER_SLOT mp_mode=mpi interactive
"""
stub:
"""
template_base=\$(basename "$inputfile_template" .inp)
jobname="\${template_base}_${cof}"
echo "running abaqus (restart)"
echo "#test" > \${jobname}.dat
echo "#test" > \${jobname}.msg
echo "#test" > \${jobname}.odb
echo "#test" > \${jobname}.res
"""
}
process run_abaqus_datacheck {
label 'abaqus_datacheck'
errorStrategy 'finish'
publishDir "output", mode: 'copy'
input:
path inputfile_template
path node_file
path element_file
val cof
output:
path '*.dat', emit: dat
script:
"""
create_tag() {
local text="\$1"
curl -H "Authorization: Token \${RESCALE_API_KEY}" -H "Content-Type: application/json" "\${RESCALE_API_BASE_URL}/api/v2/jobs/\${RESCALE_JOB_ID}/tags/" -X POST -d "{ \\"name\\": \\"\${text}\\" }"
}
create_tag "Computational_Pipeline"
runname=\$(basename "${workflow.projectDir}")
create_tag "Study:\${runname}"
create_tag "cof:${cof}"
template_base=\$(basename "$inputfile_template" .inp)
jobname="\${template_base}_${cof}"
inputfile="\${jobname}.inp"
cp $inputfile_template \$inputfile
sed -i 's/<cof>/$cof/g' \$inputfile
abaqus datacheck job=\$jobname cpus=\$RESCALE_CORES_PER_SLOT mp_mode=mpi interactive
"""
stub:
"""
echo "running abaqus datacheck"
cp -v /Users/bitsche/Downloads/brake_squeal_template_0.3.dat .
"""
}
process select_hardware {
debug true
input:
path datfile
output:
env ct_code, emit: coretype_code
env c_count, emit: corecount
script:
"""
suggest_hardware.py $datfile 2>&1
ct_code=\$(cat hardware.json | jq -r '.code')
c_count=\$(cat hardware.json | jq -r '.corecount')
"""
stub:
"""
ct_code=kyanite
c_count=4
echo "Suggestion: \${ct_code} on \${c_count} cores"
"""
}