forked from NREL/PowerGridworld
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·72 lines (47 loc) · 1.63 KB
/
run.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
#!/usr/bin/bash
# ./run.sh -i s3://home-steward-s3bucket/base-train/inputs/ -o s3://home-steward-s3bucket/base-train/outputs
Help()
{
# Display Help
echo "This script run training ."
echo
echo "Syntax: scriptTemplate [-i|o|h]"
echo "options:"
echo "i input location in s3 directory (i.e <bucket name>/base-train/inputs/)"
echo "o output location in s3 directory (i.e <bucket name>/base-train/outputs/)"
echo "h help"
echo
}
while getopts i:o:h: flag
do
case "${flag}" in
i) infolder=${OPTARG}
;;
o) outfolder=${OPTARG}
;;
h) Help
;;
*) echo "Invalid option: -$flag"
Help
;;
esac
done
echo "building docker container"
aws s3 cp $infolder data/inputs --recursive
sudo rm -rf data/outputs/*
wait 20
echo "building docker container"
sudo docker build . -t homesteward:latest # RUn Dockerfile
echo "run container in a detached mode"
sudo docker run -v $(pwd)/data/outputs:/PowerGridworld/data/outputs --name hscontainer -it -d homesteward:latest bash /PowerGridworld/examples/marl/rllib/heterogeneous/train_hs.sh
status_code="$(docker container wait hscontainer)"
echo "Status code of Home Steward Training: ${status_code}"
#to check inside the container
#docker exec -it hscontainer /bin/bash
aws s3 cp data/outputs/ray_results/PPO $outfolder --recursive
echo "stop the running container"
docker stop hscontainer
echo "Delete the built docker container"
docker rm hscontainer
#echo "prune images"
#docker image prune -f