-
Notifications
You must be signed in to change notification settings - Fork 0
/
sniper-prep.sh
executable file
·82 lines (60 loc) · 2.23 KB
/
sniper-prep.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
#!/bin/bash
pod=$(kubectl get pod | grep satellite-preprocessing | awk -F " " '{print $1}')
podprefix="kubectl exec -it "
podcom=" -- "
commander=${podprefix}${pod}${podcom}
alias kes="$commander"
podcount=10
#kes rm -rf /mnt/geojson
#kes mkdir /mnt/geojson
# sh blah.sh -path(p) -m(model)
# while getopts ":p:" opt
# do
# case $opt in
# p)
# impath=${OPTARG}
# datapath=${OPTARG}
# datapath=${datapath%/*} #os dirname
# datapath=${datapath##*/} #os basename
# prefix="/mnt/"
# befix="/"
# ;;
# esac
# done
# /home/ashwin/Desktop/New_Data/Davis_Monthan/Davis_Monthan_AFB_20180814.tif
# ${datapath%/*} - /home/ashwin/Desktop/New_Data/Davis_Monthan/
# ${datapath##*/} - Davis_Monthan_AFB_20180814.tif
DIR='/home/ubuntu/redkube/nfs/sat_images'
for IMAGE in $DIR/*.tif*
do
# Puts impath in the nfs fodler so its accessbile by the container
# $IMAGE -> gets you the fullpath
# ${IMAGE##*/} -> gets you the dirname
# ${IMAGE##*/} -> gets you the filename
echo /mnt/sat_images/${IMAGE##*/} | tee /home/ubuntu/redkube/nfs/impath.txt
echo 'Clearing queues'
# Clear main and processing queues
kes redis-cli -h redis del job:processing exit
kes redis-cli -h redis del job exit
kes redis-cli -h redis del result:processing exit
kes redis-cli -h redis del result exit
kes redis-cli -h redis del status:processing exit
kes redis-cli -h redis del status exit
# Crop
kes rm -rf /mnt/crops
echo 'begin crop'
kes python /mnt/scripts/crop_service.py --dataset /mnt/sat_images/${IMAGE##*/} --image_dir /mnt/sat_images/ --image_size 1024 --pod $podcount
# Create a path file to point to the image location
echo 'finish crop'
echo 'Setting up pod specifications'
python /home/ubuntu/redkube/nfs/scripts/pod_setup.py --pods $podcount --gpu 1 --yaml /home/ubuntu/redkube/models/sniper/model_yamls/jobservice_sniper.yaml
echo 'Pod Setup Complete'
# Inference
echo 'Begin inference'
kubectl create -f /home/ubuntu/redkube/models/sniper/model_yamls/jobservice_sniper.yaml
# judge_queue checks the status of the queue and if it's empty, waits for 30 seconds
kes python /mnt/scripts/judge_queue.py --queue job
kes python /mnt/scripts/judge_queue.py --queue result
kubectl delete job sniper-inference
echo 'Finished!'
done