Skip to content

Commit 653403c

Browse files
Mikel CortesMikel Cortes
authored andcommitted
Include the -o flag for a projects overview
1 parent 15c2926 commit 653403c

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

armiarma.sh

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ Help()
3030
echo " *Parameters for -p [name]"
3131
echo " -f Run a time specified test, performing the analysis"
3232
echo " of the obtained"
33+
echo " *Parameters for -f [network] [project-name] [time](minutes)"
34+
echo " -o Run the general analysis over the entire projects' folder."
35+
echo ""
3336
echo " Parameters:"
3437
echo " [network] The ETH2 network where the crawler will be running"
3538
echo " Currently supported networks:"
3639
echo " -> mainnet"
3740
echo " [project-name] Specify the name of the folder where the metrics"
3841
echo " and plots will be stored."
3942
echo " Find them on 'armiarma/examples/[project-name]'"
43+
echo " [time] Specific time in minutes to run the crawler, performing afterwards"
44+
echo " the general analysis."
45+
echo ""
4046
echo ""
4147
echo " BSC-ETH2 TEAM"
4248
}
@@ -142,7 +148,7 @@ LaunchCrawler(){
142148
# Move to the example folder
143149
cd "./examples/${folderName}"
144150

145-
# Append the bash env variables to the temp file
151+
# Append the bash env variables to the temp fhiustile
146152
echo "metricsFolder=\"${metricsFolder}\"" >> config.sh
147153
echo "armiarmaPath=\"${folderPath}\"" >> config.sh
148154

@@ -211,7 +217,7 @@ LaunchAnalyzer(){
211217
echo "venv already created"
212218
else
213219
echo "Generating the virtual env"
214-
python -m virtualenv "$VENV"
220+
python3 -m virtualenv "$VENV"
215221
fi
216222
echo ""
217223
# Source the virtual env
@@ -230,7 +236,7 @@ LaunchAnalyzer(){
230236
# -- END TEMP --
231237

232238
echo "Checking if Python dependencies are installed..."
233-
pip install -r ./src/analyzer/requirements.txt
239+
pip3 install -r ./src/analyzer/requirements.txt
234240
echo ""
235241

236242
# Set the Paths for the gossip-metrics.json peerstore.json and output
@@ -249,20 +255,53 @@ LaunchAnalyzer(){
249255
# Run the Analyzer
250256
echo " Launching analyzer"
251257
echo ""
252-
python ./src/analyzer/armiarma-analyzer.py "$csv" "$peerstore" "$extrametrics" "$plots"
258+
python3 ./src/analyzer/armiarma-analyzer.py "$csv" "$peerstore" "$extrametrics" "$plots"
253259

254260
# Deactivate the VENV
255261
deactivate
256262

257263
}
258264

265+
# Launch the General Overview of all the projects in the examples folder
266+
LaunchGeneralResults(){
267+
if [[ -d "./general-results/plots" ]]; then
268+
echo ""
269+
else
270+
mkdir "./general-results/plots"
271+
fi
272+
273+
# Source the virtual env
274+
source "${VENV}/bin/activate"
275+
276+
# Check if the virtual env is created
277+
venvPath="${PWD}/src/analyzer/venv"
278+
if [[ "$VIRTUAL_ENV" = "$venvPath" ]]
279+
then
280+
echo "VENV successfuly sourced"
281+
else
282+
echo "ERROR. VENV was unable to source" >&2
283+
fi
284+
echo ""
285+
286+
# Run the Analyzer
287+
echo " Launching General Overview Analyzer"
288+
echo ""
289+
python3 ./src/analyzer/total-overview-analysis.py ./examples ./results
290+
echo "results available in \$ARMIARMA/results"
291+
echo ""
292+
# Deactivate the VENV
293+
deactivate
294+
}
295+
296+
259297
# -------- END OF FUNCTION DEFINITION ---------
260298

261299
# Execution Secuence
262300

263301
# 0. Get the options
264302
go version
265303

304+
# Generate the examples folder
266305
if [[ -d ./examples ]]; then
267306
echo ""
268307
echo " ----------- ARMIARMA $version -----------"
@@ -274,6 +313,15 @@ else
274313
echo ""
275314
mkdir ./examples
276315
fi
316+
# Generate the general-results folder
317+
if [[ -d ./general-results ]]; then
318+
echo ""
319+
else
320+
echo ""
321+
echo "Generating ./general-results folder"
322+
echo ""
323+
mkdir ./general-results
324+
fi
277325

278326
# Check if any argument was given.
279327
# If not, print Help and exit
@@ -283,7 +331,7 @@ if [[ -z "$1" ]]; then
283331
exit 1
284332
fi
285333

286-
while getopts ":hcpfdts" option; do
334+
while getopts ":hcpfdo" option; do
287335
case $option in
288336
h) # display Help
289337
Help
@@ -329,10 +377,18 @@ while getopts ":hcpfdts" option; do
329377

330378
echo "Calling the Analyzer"
331379
LaunchAnalyzer "$folderName" "$folderPath"
332-
380+
333381
echo "Exit Crawler execution"
334382
exit;;
335383

384+
o) # Generate the general overview of the previously generated projects
385+
386+
LaunchGeneralResults
387+
388+
echo "Overview Analyzer Finished!"
389+
echo ""
390+
exit;;
391+
336392
d) # Option to run Armiarma Crawler for a specific given time on the iexec decentralice platform
337393
# processing the results with the Analyzer and returning the metrics and plots in a zip file
338394
# TODO: encrypt the results with a certain security measure, so noone can access to them

0 commit comments

Comments
 (0)