-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.sh
37 lines (26 loc) · 832 Bytes
/
test.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
#!/bin/bash
# initial check
if [ "$#" != 1 ]; then
echo "$# parameters given. Only 1 expected. Use -h to view command format"
exit 1
fi
if [ "$1" == "-h" ]; then
echo "Usage: `basename $0` [file to evaluate upon]"
exit 1
fi
test_path=$1
# delete old docker if exists
docker ps -q --filter "name=nlp2020-hw1" | grep -q . && docker stop nlp2020-hw1
docker ps -aq --filter "name=nlp2020-hw1" | grep -q . && docker rm nlp2020-hw1
# build docker file
docker build . -f Dockerfile -t nlp2020-hw1
# bring model up
docker run -d -p 12345:12345 --name nlp2020-hw1 nlp2020-hw1
# perform evaluation
/usr/bin/env python3 hw1/evaluate.py $test_path
# stop container
docker stop nlp2020-hw1
# dump container logs
docker logs -t nlp2020-hw1 > logs/server.stdout 2> logs/server.stderr
# remove container
docker rm nlp2020-hw1