-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·95 lines (86 loc) · 2.77 KB
/
entrypoint.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
function display_help {
echo 'USAGE:'
echo 'docker run -ti [--rm] --mount source=$(pwd)/src,destination=/tmp/echr_experiments,type=bind,readonly <image_id|image_name[:image_tag]> [help | bash | /bin/bash | deploy | build | pytest [pytest options] [file_or_dir] [...] | lint | all]'
echo
echo 'OPTIONS:'
echo ' help - Prints this help and exits.'
echo ' bash | /bin/bash - Allows to access bash console of the container.'
echo ' test - Runs pytest'
echo ' run - Run the experiments'
echo ' analyze - Analyze the results of the experiments'
echo ' lint - Runs pylint.'
}
function check {
if [[ "$2" = 'binary' ]] ; then
python3 ./binary_check.py ${@:3}
elif [[ "$2" = "multiclass" ]] ; then
python3 ./multiclass_check.py ${@:3}
elif [[ "$2" = "multilabel" ]] ; then
python3 ./multilabel_check.py ${@:3}
fi
}
function run {
if [[ "$2" = 'binary' ]] ; then
python3 ./binary_experiments.py ${@:3}
elif [[ "$2" = "multiclass" ]] ; then
python3 ./multiclass_experiments.py ${@:3}
elif [[ "$2" = "multilabel" ]] ; then
python3 ./multilabel_experiments.py ${@:3}
fi
}
function analyze {
if [[ "$2" = 'binary' ]] ; then
echo "Confusion Matrices"
python3 ./binary_confusion_matrices.py
echo "Latex Tables"
python3 ./binary_generate_latex.py
elif [[ "$2" = "multiclass" ]] ; then
echo "Confusion Matrices"
python3 ./multiclass_confusion_matrices.py
echo "Latex Tables"
python3 ./multiclass_generate_latex.py
elif [[ "$2" = "multilabel" ]] ; then
echo "Latex Tables"
python3 ./multilabel_generate_latex.py
fi
}
function reports {
python3 ./generate_reports.py
pdflatex ./data/analysis/report.tex
pdflatex ./data/analysis/report.tex
mv ./report.pdf ./data/analysis/report.pdf
}
function lint_source_code {
python -m pylint --rcfile=.pylintrc *.py
}
function handle_input {
if [[ "$#" -eq 0 ]] ; then
display_help
else
if [[ "$1" = 'bash' || "$1" = '/bin/bash' ]] ; then
/bin/bash
elif [[ "$1" = "run" ]] ; then
run $@
elif [[ "$1" = "check" ]] ; then
check $@
elif [[ "$1" = "analyze" ]] ; then
analyze $@
elif [[ "$1" = "reports" ]] ; then
reports $@
elif [[ "$1" = "test" ]] ; then
python -m pytest -v -c ./.pytest.ini --disable-warnings &&\
lint_source_code
elif [[ "$1" = 'lint' ]] ; then
lint_source_code
else
display_help
fi
fi
}
function main() {
handle_input $@
status_code=$?
exit ${status_code}
}
main $@