Skip to content

Commit 1b3a562

Browse files
author
Elliot Kim
committed
gets every tenth commit and runs throughput tests on them and prints it out in a file
1 parent 0dad4bb commit 1b3a562

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/sh
2+
3+
# Repository URL and directory setup
4+
REPO_URL="https://github.com/cooperative-computing-lab/cctools"
5+
REPO_DIR="github-cctools"
6+
7+
. ./install-common.sh
8+
9+
# Log file for results
10+
LOG_FILE="./test_results.log"
11+
printf "%-40s %-20s %-20s %-25s %-25s %-20s %-20s\n" \
12+
"Version" "Python Throughput" "Python Chaining" \
13+
"Serverless Throughput" "Serverless Chaining" \
14+
"C Throughput" "C Chaining" > $LOG_FILE
15+
16+
# Clone the repository
17+
git clone "$REPO_URL" "$REPO_DIR"
18+
19+
# Navigate to the repository
20+
cd $REPO_DIR
21+
22+
# COMMITS=($(git log -n 1000 --format="%H" | awk 'NR % 10 == 1'))
23+
24+
COMMITS=($(git log --format="%H" | awk 'NR % 10 == 1'))
25+
26+
if [ ${#COMMITS[@]} -eq 0 ]; then
27+
echo "Error: No commits found or repository history is empty."
28+
exit 1
29+
fi
30+
31+
echo "Selected commits:"
32+
printf "%s\n" "${COMMITS[@]}"
33+
34+
# Activate the conda environment
35+
conda activate cctools-dev
36+
37+
PREFIX=$CONDA_PREFIX
38+
39+
# Function to sanitize and format results
40+
sanitize_and_format() {
41+
echo "$1" | grep -Eo "^[0-9.]+$" | head -n 1
42+
}
43+
44+
# Iterate through each commit
45+
for COMMIT in "${COMMITS[@]}"; do
46+
47+
48+
echo "Testing commit: $COMMIT"
49+
git checkout -b temp_branch_$COMMIT $COMMIT
50+
51+
52+
53+
# Build TaskVine
54+
./configure --prefix="$PREFIX" --with-base-dir="$PREFIX"
55+
make clean && make install -j8
56+
57+
# Set environment variables
58+
export PATH="$PREFIX/bin:$PATH"
59+
export PYTHONPATH="${PREFIX}/lib/python3.*/site-packages"
60+
export LD_LIBRARY_PATH="$PREFIX/lib"
61+
cd ..
62+
63+
# Run the Python test
64+
echo "Running Python test..."
65+
PYTHON_OUTPUT=$(python3 test-vine-task-throughput.py)
66+
PYTHON_THROUGHPUT_RESULT=$(sanitize_and_format "$(echo "$PYTHON_OUTPUT" | grep -Eo "Throughput was [0-9.]+ tasks per second" | grep -Eo "[0-9.]+")")
67+
PYTHON_CHAINING_RESULT=$(sanitize_and_format "$(echo "$PYTHON_OUTPUT" | grep -Eo "Chaining was [0-9.]+ tasks per second" | grep -Eo "[0-9.]+")")
68+
SERVERLESS_THROUGHPUT_RESULT=$(sanitize_and_format "$(echo "$PYTHON_OUTPUT" | grep -Eo "Serverless Throughput was [0-9.]+ tasks per second" | grep -Eo "[0-9.]+")")
69+
SERVERLESS_CHAINING_RESULT=$(sanitize_and_format "$(echo "$PYTHON_OUTPUT" | grep -Eo "Serverless Chaining was [0-9.]+ tasks per second" | grep -Eo "[0-9.]+")")
70+
71+
# Compile and run the C test
72+
echo "Compiling and running C test..."
73+
${CC:-gcc} test-vine-task-throughput.c -o test-vine-task-throughput -I "$PREFIX/include/cctools/" -L "$PREFIX/lib" -ltaskvine -ldttools -lm -lcrypto -lssl -lz
74+
./test-vine-task-throughput > c_output.log 2>&1 &
75+
76+
# Run the worker command immediately
77+
vine_worker localhost 9123 --single-shot
78+
79+
# Wait for the background process to complete
80+
wait
81+
82+
# Capture the output from the file
83+
C_OUTPUT=$(cat c_output.log)
84+
C_THROUGHPUT_RESULT=$(sanitize_and_format "$(echo "$C_OUTPUT" | grep -Eo "Throughput was [0-9.]+ tasks per second" | grep -Eo "[0-9.]+")")
85+
C_CHAINING_RESULT=$(sanitize_and_format "$(echo "$C_OUTPUT" | grep -Eo "Chaining was [0-9.]+ tasks per second" | grep -Eo "[0-9.]+")")
86+
87+
# Append results to the log
88+
printf "%-40s %-20s %-20s %-25s %-25s %-20s %-20s\n" \
89+
"$COMMIT" "$PYTHON_THROUGHPUT_RESULT" "$PYTHON_CHAINING_RESULT" \
90+
"$SERVERLESS_THROUGHPUT_RESULT" "$SERVERLESS_CHAINING_RESULT" \
91+
"$C_THROUGHPUT_RESULT" "$C_CHAINING_RESULT" >> $LOG_FILE
92+
cd $REPO_DIR
93+
git branch -D temp_branch_$COMMIT || echo "Branch temp_branch_$COMMIT already deleted or not found"
94+
done
95+
96+
# Display the test results
97+
echo "Testing complete. Results saved to $LOG_FILE."
98+
cat $LOG_FILE

0 commit comments

Comments
 (0)