-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.bash
70 lines (70 loc) · 2.67 KB
/
script.bash
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
# == Printing received params ([l/s] [table_name])
echo "==Printing selection=="
echo "Server or local: $1"
echo "Database Table Name: $2"
echo ""
#
# == Creating the log folder
echo "Creating folder..."
folder=$(date +'%Y-%m-%d__%H.%M.%S')
mkdir -m 777 -p "logs/${folder}"
mkdir -m 777 -p "logs/${folder}/extra"
#
# == Checking the data files to be used
local="l"
half_data="TEMPERATURE_HalfGB.csv"
full_data="TEMPERATURE_1GB.csv"
sleep_time="2h"
if [ "$1" = "$local" ]; then
half_data="TEMPERATURE.csv"
sleep_time="20s"
fi
#
# System variable
indexNames=("no" "timestamp" "timestamp_and_value")
#
# Iterating through indices
for index in 0 1 2
do
#
# == Executing N Ingestion ([M] [N] [l/s] [table_name] [file_name_in_data_folder])
echo "Executing NDataIngestionTest.jar..."
java -jar standalone/NDataIngestionTest.jar 300 300 $1 $2 ${half_data} > "logs/${folder}/extra/out__N_ingestion.txt"
rm -r logs/2020*_300
echo "Ingestion completed!"
echo ""
#
# == Changing index ([l/s] [dbName] [0/1/2])
echo "Set index to \"${indexNames[$index]}\""
#nohup bash index__compile_and_run.bash $1 $2 $index > "logs/${folder}/extra/out__index.txt" 2> "logs/${folder}/extra/err__index.txt" &
nohup java -jar standalone/IndexMixed.jar $1 $2 $index > "logs/${folder}/extra/out__index.txt" 2> "logs/${folder}/extra/err__index.txt" &
#
# == Executing Ingestion Part ([l/s] [dbName] [data_file_name] [log_folder] [0/1/2])
echo "Executing IngestionMixed.jar ..."
#nohup bash ing__compile_and_run.bash $1 $2 ${full_data} $folder $index > "logs/${folder}/extra/out__ingestion.txt" 2> "logs/${folder}/extra/err__ingestion.txt" &
nohup java -jar standalone/IngestionMixed.jar $1 $2 ${full_data} $folder $index > "logs/${folder}/extra/out__ingestion.txt" 2> "logs/${folder}/extra/err__ingestion.txt" &
#
# == Executing Querying Part ([l/s] [dbName] [log_folder] [0/1/2])
echo "Executing QueryingMixed.jar ..."
#nohup bash query__compile_and_run.bash $1 $2 $folder $index > "logs/${folder}/extra/out__querying.txt" 2> "logs/${folder}/extra/err__querying.txt" &
nohup java -jar standalone/QueryingMixed.jar $1 $2 $folder $index > "logs/${folder}/extra/out__querying.txt" 2> "logs/${folder}/extra/err__querying.txt" &
#
# == Waiting 2 hours
echo "Sleeping 2 hours..."
sleep ${sleep_time}
#
# == Stopping the processes
echo ""
echo "Stopping processes..."
kill $(ps | grep java | awk '{print $1;}')
#
# == Last fixes to output
echo "Fixing some things..."
echo "</logs>" >> "logs/${folder}/querying_${indexNames[$index]}.xml"
echo "</logs>" >> "logs/${folder}/ingestion_${indexNames[$index]}.xml"
#
# == Completed!
echo "Completed for this index!"
done
#
echo "Finished it all!"