-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_stubs.sh
75 lines (64 loc) · 1.8 KB
/
run_stubs.sh
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
NEXTFLOW_RUN='nextflow run /home/ajm/code/nf-teirex-dia/main.nf -profile standard -stub -resume -c pipeline.config'
STUB_DIRS=('panorama_diann_libFree_stub' 'panorama_diann_stub' 'panorama_encyclopedia_skyline_stub' 'panorama_msconvert_only_stub' 'pdc_diann_stub' 'panorama_local_mix_stub')
function usage() {
echo "run_test_workflows.sh [--noResume] [stub_dir] [...]"
}
arg_dirs=()
for i in "$@" ; do
case $1 in
-f|--noResume)
NEXTFLOW_RUN='nextflow run /home/ajm/code/nf-teirex-dia/main.nf -profile standard -stub -c pipeline.config'
;;
-h|--help)
usage
exit 0
;;
*)
while ! [[ -z "$1" ]] ; do
if [[ "$1" == -* ]] ; then
echo "Unknown option: \'$1\'"
usage
exit 1
else
arg_dirs+=( "$1" )
fi
shift
done
;;
esac
shift
done
if [ ${#arg_dirs[@]} -eq 0 ] ; then
stub_dirs=(${STUB_DIRS[@]})
else
stub_dirs=(${arg_dirs[@]})
fi
declare -A exit_codes
declare -A exit_code_count=(['success']=0 ['failure']=0)
for d in ${stub_dirs[@]} ; do
pushd $d
if [ $? -eq 0 ] ; then
echo $NEXTFLOW_RUN
$NEXTFLOW_RUN
rc=$?
popd
else
rc=127
fi
exit_codes["$d"]=$rc
if [ $rc -eq 0 ] ; then
((exit_code_count['success']++))
else
((exit_code_count['failure']++))
fi
done
echo -e "\n${exit_code_count['success']} succeded, ${exit_code_count['failure']} failed"
if [ ${exit_code_count['failure']} -gt 0 ] ; then
echo
for d in ${!exit_codes[@]} ; do
if [ ${exit_codes["$d"]} -ne 0 ] ; then
echo "Failure: $d, rc=${exit_codes["$d"]}"
fi
done
echo
fi