forked from koksal/tps
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathworkflow.sh
65 lines (56 loc) · 1.42 KB
/
workflow.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
#!/bin/bash
if (($# == 0)); then
echo "usage: bash workflow.sh --config [config.yml] --execute [all|annotations|tps]"
exit 0
fi
POSITIONAL_ARGS=()
HELP_MSG=NO
while [[ $# -gt 0 ]]; do
case $1 in
-c|--config)
CONFIG="$2"
shift # past argument
shift # past value
;;
-e|--execute)
EXECUTE="$2"
shift # past argument
shift # past value
;;
--help)
HELP_MSG=YES
shift # past argument with no value
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
if [ ${HELP_MSG} == YES ]; then
echo "usage: bash workflow.sh --config [config.yml] --execute [all|annotations|tps]"
exit 0
fi
echo "CONFIG FILE = ${CONFIG}"
echo "EXECUTION SETTING = ${EXECUTE}"
if [[ -n $1 ]]; then
echo "error: invalid arguments"
echo "usage: bash workflow.sh --config [config.yml] --execute [all|annotations|tps]"
exit 0
fi
echo "activate TPS environment"
eval "$(conda shell.bash hook)"
conda activate tps_workflow
if [ $? -ne 0 ]; then
echo "environment does not exist"
echo "creating TPS environment"
conda env create -f workflow/minimal_env.yml
conda activate tps_workflow
fi
echo "environment activated"
python tps_workflow.py --config ${CONFIG} --execute ${EXECUTE}