Last active
January 12, 2020 14:06
-
-
Save yunpengn/906b90ce7298317d447135de9c6f1c79 to your computer and use it in GitHub Desktop.
A simple Bash script to run Calcite & SQLidate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Validates input. | |
if [[ "$1" == "" ]]; then | |
printf "Please specify the number of nodes.\n" | |
exit | |
fi | |
# Pulls the latest changes. | |
printf "Going to pull the latest changes ...\n" | |
cd /temp/yunpengn/calcite | |
git pull | |
# Compiles the core module. | |
printf "\nGoing to compile the core module ...\n" | |
cd core/ | |
../mvnw compile | |
# Runs the RandomQueries class inside the core module. | |
printf "\nGoing to run the core module ...\n" | |
rm -f /temp/yunpengn/log/out_calcite_*.log | |
rm -f /temp/yunpengn/calcite/core/output_*.txt | |
rm -f /temp/yunpengn/calcite/core/output.txt | |
for ((c=0; c<$1; c++)); do | |
printf "Going to run partition #${c} ...\n" | |
../mvnw exec:java -Dexec.args="$1 ${c}" > /temp/yunpengn/log/out_calcite_${c}.log 2>&1 & | |
done | |
# Reads the output of the program. | |
printf "\nAll nodes have been started. Going to tail the output of partition #0 ...\n" | |
tail -f /temp/yunpengn/log/out_calcite_0.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pulls the latest changes. | |
printf "Going to pull the latest changes ...\n" | |
cd /temp/yunpengn/SQLidate | |
git pull | |
# Compiles the JAR. | |
printf "\nGoing to compile the JAR ...\n" | |
./gradlew shadowJar | |
# Constructs the database. | |
printf "\nGoing to (re-)construct the database ...\n" | |
psql -U e0134079 -d template1 -a -f /temp/yunpengn/SQLidate/src/main/resources/init_db.sql | |
psql -U e0134079 -d e0134079 -a -f /temp/yunpengn/SQLidate/src/main/resources/init_schema.sql | |
# Runs the data loader. | |
printf "\nGoing to run data loader ...\n" | |
java -jar ./build/libs/SQLidate-1.0-SNAPSHOT-all.jar load 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pulls the latest changes. | |
printf "Going to pull the latest changes ...\n" | |
cd /temp/yunpengn/SQLidate | |
git pull | |
# Compiles the JAR. | |
printf "\nGoing to compile the JAR ...\n" | |
./gradlew shadowJar | |
# Aggregates all input files. | |
printf "\nGoing to aggregate all input files ...\n" | |
rm -f /temp/yunpengn/calcite/core/output.txt | |
cat /temp/yunpengn/calcite/core/output_*.txt > /temp/yunpengn/calcite/core/output.txt | |
# Runs the result verifier. | |
printf "\nGoing to run the result verifier ...\n" | |
rm -f /temp/yunpengn/SQLidate/out.log | |
rm -f /temp/yunpengn/SQLidate/out.err.log | |
rm -f /temp/yunpengn/log/out_SQLidate.log | |
java -jar ./build/libs/SQLidate-1.0-SNAPSHOT-all.jar check /temp/yunpengn/calcite/core/output.txt > /temp/yunpengn/log/out_SQLidate.log 2>&1 & | |
# Reads the output of the program. | |
printf "\nGoing to tail the program output ...\n" | |
tail -f /temp/yunpengn/log/out_SQLidate.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment