-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_simulator.sh
executable file
·194 lines (168 loc) · 6.04 KB
/
run_simulator.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/bash
clear
source venv36/bin/activate
source chave.conf
if [ "$1" == "install" ]; then
CS_INSTALL
exit
else
COMMIT=$1
echo -e "Your commit message for this simulations instance is ${COMMIT}"
fi
mkdir -p ${CS_LOG_PATH} 2> /dev/null
mkdir -p ${CS_DATA_PATH} 2> /dev/null
echo -e "${CS_LOGO} ${_NC}"
CLEAR_ALL=false
PLOT=true
SYNC=true
if ${CLEAR_ALL} == true; then
rm -rf "${CS_PROJ_ROOT}/output/"
fi
AZ_CONF=( 13 24 7 12 7 8 12 8 31 32 31 32 ) # ('node core')
#________________
#/ |AZ_|Node|Cores\ {CHAVE}
#/ | 1 | 13 | 24 |\____
#/ | 2 | 7 | 12 | >LC0\__ Source: ${CS_SOURCE_FOLDER}
#/ /\ | 3 | 7 | 8 |/ \__/l__/L___/l_/l__M___
#\ \/ |===|====|=====K >_GC___ ____ ___ __/
#\ | 4 | 12 | 8 |\ __/ \/ \/ \/ V
#\ | 5 | 31 | 32 | >LC1/ Log Level: ${CS_LOG_LEVEL}
#\_|_6_|_31_|_32__|/
TEST_LIST=( 'EUCA' 'CHAVE' ) # 'MM' MBFD )
FF_LIST=( 'FFD2I') # 'FF3D')
CONSOLID_ALGO=( 'LOCK' 'MAX' ) # 'MIN' ) # 'ha' )
WITH_CONSOLID=( 'False' 'True' )
WITH_OVERCOMM=( 'False' )
ENABLE_REPLIC=( 'False' 'True' )
LOCK_CASE=( 'RANDOM' 'False' 'None' ) #'True'
WT=('1' '2' '2') # Window time means: ('min' 'step' 'max')
# TODO: implemetar um criador de AZs e regioes
# AZ_2_REGIONS=('HA' 'LB' 'BF')
# Sources:
SRC_LIST=(`ls -d ${CS_FDR_EUCALYPTUS}/* | grep trace.txt`)
SRC_LIST_PLUS=(`ls -d ${CS_FDR_EUCALYPTUS}/* | grep trace-plus.txt`)
if [[ ${#SRC_LIST_PLUS[@]} -lt ${#SRC_LIST[@]} ]]; then
echo -e "${_RED}Genearting some plus info! ${#SRC_LIST_PLUS[@]} < ${#SRC_LIST[@]} ${_NC}"
# Doc: two parameters: <'trace_plus'> or :TODO: <'create_trace'>
bash gvt.sh 'trace_plus'
SRC_LIST_PLUS=(`ls -d ${CS_FDR_EUCALYPTUS}/* | grep trace-plus.txt`)
fi
NIT=()
for SRC in ${SRC_LIST[@]}; do
NIT+=( `wc -l < ${SRC}` )
done
pushd . > /dev/null
cd src
RUN_S=`date +%s`
# --tmpdir /media/debian/logs -j16
if [ ${CS_isAWS} == true ]; then
${PARALLEL} --bar ${CS_PY} main.py -nit ${NIT[@]} -in ${SRC_LIST[@]} -az ${AZ_CONF[@]} -ha ${SRC_LIST_PLUS[@]} -alg {1} -ca {2} -ff {3} -wt {4} -lock {5} -ovc {6} -cons {7} -repl {8} ::: \
${TEST_LIST[@]} ::: \
${CONSOLID_ALGO[@]} ::: \
${FF_LIST[@]} ::: \
$(seq ${WT[0]} ${WT[1]} ${WT[2]}) ::: \
${LOCK_CASE[@]} ::: \
${WITH_OVERCOMM[@]} ::: \
${WITH_CONSOLID[@]} ::: \
${ENABLE_REPLIC[@]} ::: \
elif [ ${CS_isG5K} == true ]; then # If in Grid 5000 we need use nested for #
TEST=${TEST_LIST[0]} # test for 'CHAVE' algorithm
for OC in ${WITH_OVERCOM[@]}; do
for PM in "${PM_LIST[@]}"; do
for FF in "${FF_LIST[@]}"; do
for TIME in `seq ${WT[0]} ${WT[1]} ${WT[2]}`; do
for SIZE in `seq ${WS[0]} ${WS[1]} ${WS[2]}`; do
it=0
for SRC in "${SRC_LIST[@]}"; do
echo -e "Executing Test"`date +${CS_DP}`"_${TEST}_${PM}_${FF}_${TIME}_${SIZE}_${OC}"
${CS_PY} main.py\
-nit ${NIT[$it]}\
-algorithm $TEST\
-pm $PM\
-ff $FF\
-input "$FDR_EUCALYPTUS/$SRC"\
-az ${AZ_LIST[$it]}\
-wt "$TIME"\
-ws "$SIZE"\
-ovc $OC
let "it++"
done
done
done
done
done
done
TEST=${TEST_LIST[1]} # EUCA
PM="None"
FF="None"
for OC in ${WITH_OVERCOM[@]}; do
for TIME in `seq ${WT[0]} ${WT[1]} ${WT[2]}`; do
for SIZE in `seq ${WS[0]} ${WS[1]} ${WS[2]}`; do
it=0
for SRC in "${SRC_LIST[@]}"; do
echo -e "Executing Test"`date +${CS_DP}`"_${TEST}_${PM}_${FF}_${TIME}_${SIZE}_${OC}"
${CS_PY} main.py\
-nit ${NIT[$it]}\
-algorithm $TEST\
-pm $PM\
-ff $FF\
-input "$FDR_EUCALYPTUS/$SRC"\
-az ${AZ_LIST[$it]}\
-wt "$TIME"\
-ws "$SIZE"\
-ovc $OC
let "it++"
done
done
done
done
fi
let "_END=`date +%s`-${RUN_S}"
_NOW=`date +${CS_DP}`
SIM_RESULT="This simulation ended at ${_NOW} and took ${_END} seconds."
echo -e "${_RED}\n\t ${SIM_RESULT} ${_NC}"
echo -e ${SIM_RESULT} >> "${CS_OUTPUT_PATH}/simulation_resume.txt"
echo -e ${COMMIT} >> "${CS_OUTPUT_PATH}/simulation_resume.txt"
popd > /dev/null
#if [ "${USER}" == "ubuntu" ]; then
# scp -i /home/${USER}/Dropbox/chave2.pem ${CS_DATA_PATH} 10.0.0.16:/var/www/html/
# scp -i /home/${USER}/Dropbox/chave2.pem ${CS_LOG_PATH} 10.0.0.16:/var/www/html/
#fi
CS_BELL 3
sleep 30
# Todo: Automatizar processo
if [ ${PLOT} == true ]; then
pushd .
cd ${CS_PROJ_ROOT}/Plots/
sudo R -f install.R
R -f database.R ${CS_OUTPUT_PATH}
R -f databaseRadar.R ${CS_OUTPUT_PATH}
popd
fi
if [ ${SYNC} == true ]; then
command -v aws >/dev/null 2>&1 || {
echo >&2 "Is required 'awscli' but it's not installed...";
echo "sucesso" | sudo -S pip install awscli
pushd .
cd ~
unzip Dropbox/aws.zip
popd
}
S3_BUCK="chave-output"
OUTPUT="${CS_PROJ_ROOT}"/output/
aws s3 sync ${OUTPUT} s3://${S3_BUCK} --acl public-read
# --grants full=uri=http://acs.amazonaws.com/groups/global/AllUsers
fi
exit
#aws s3 mv ${OUTPUT} s3://${S3_BUCK}
# LOG_FDR="/media/debian/logs/"
# if [ -e ${LOG_FDR} ]; then
# echo "sucesso" | sudo -S rsync -ah --update --progress logs/* ${LOG_FDR}
# rm -rf logs/*
# else
# udisksctl mount --block-device=/dev/vde
# sleep 5
# echo "sucesso" | sudo -S rsync -ah --update --progress logs/* ${LOG_FDR}
# rm -rf logs/*
# fi
#fi