forked from drivendataorg/snomed-ct-entity-linking-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
47 lines (35 loc) · 1.13 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
#!/bin/bash
set -euxo pipefail
main () {
expected_filename=main.py
cd /code_execution
submission_files=$(zip -sf ./submission/submission.zip)
if ! grep -q ${expected_filename}<<<$submission_files; then
echo "Submission zip archive must include $expected_filename"
return 1
fi
echo "Unpacking submission"
unzip ./submission/submission.zip -d ./
ls -alh
if $IS_SMOKE_TEST; then
echo "Running smoke test"
python main.py
else
echo "Running submission"
python main.py &> "/code_execution/submission/private_log.txt"
fi
echo "Exporting submission.csv result..."
# Valid scripts must create a "submission.csv" file within the same directory as main
if [ -f "submission.csv" ]
then
echo "Script completed its run."
cp submission.csv ./submission/submission.csv
else
echo "ERROR: Script did not produce a submission.csv file in the main directory."
exit_code=1
fi
}
main |& tee "/code_execution/submission/log.txt"
exit_code=${PIPESTATUS[0]}
cp /code_execution/submission/log.txt /tmp/log
exit $exit_code