Skip to content

Commit dc2d426

Browse files
committed
Add feature to run in different directory
1 parent 21c65e5 commit dc2d426

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

benchmarks/bench.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
3030
# Set Defaults
3131
COMMAND=data
3232
BENCHMARK=all
33+
DATAFUSION_DIR=${DATAFUSION_DIR:-$SCRIPT_DIR/..}
3334
DATA_DIR=${DATA_DIR:-$SCRIPT_DIR/data}
34-
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
35+
BRANCH_NAME=$(cd ${DATAFUSION_DIR} && git rev-parse --abbrev-ref HEAD)
3536
BRANCH_NAME=${BRANCH_NAME//\//_} # mind blowing syntax to replace / with _
3637
RESULTS_DIR=${RESULTS_DIR:-"$SCRIPT_DIR/results/$BRANCH_NAME"}
3738
#CARGO_COMMAND=$CARGO_COMMAND:"cargo run --release"}
@@ -49,7 +50,11 @@ Usage: $0 <command> [benchmark]
4950
Examples:
5051
**********
5152
52-
./bench.sh gen # Create the datasets for all benchmarks in $DATA_DIR
53+
# Create the datasets for all benchmarks in $DATA_DIR
54+
./bench.sh data
55+
56+
# Run the 'tpch' benchmark on the datafusion checkout in /source/arrow-datafusion
57+
DATAFASION_DIR=/source/arrow-datafusion ./bench.sh run tpch
5358
5459
**********
5560
* Commands
@@ -118,6 +123,7 @@ main() {
118123
echo "DataFusion Benchmark Script"
119124
echo "COMMAND: ${COMMAND}"
120125
echo "BENCHMARK: ${BENCHMARK}"
126+
echo "DATAFUSION_DIR: ${DATAFUSION_DIR}"
121127
echo "BRACH_NAME: ${BRANCH_NAME}"
122128
echo "DATA_DIR: ${DATA_DIR}"
123129
echo "RESULTS_DIR: ${RESULTS_DIR}"
@@ -145,6 +151,8 @@ main() {
145151
esac
146152
;;
147153
run)
154+
# navigate to the appropriate checkout
155+
pushd "${DATAFUSION_DIR}/benchmarks"
148156
mkdir -p "${RESULTS_DIR}"
149157
case "$BENCHMARK" in
150158
all)
@@ -161,6 +169,7 @@ main() {
161169
usage
162170
;;
163171
esac
172+
popd "${DATAFUSION_DIR}/benchmarks"
164173
;;
165174
*)
166175
echo "Error: unknown command: $COMMAND"

0 commit comments

Comments
 (0)