Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 13 additions & 82 deletions presto/scripts/run_integ_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,88 +49,19 @@ EOF

KEEP_TABLES=false

parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
print_help
exit 0
;;
-b|--benchmark-type)
if [[ -n $2 ]]; then
BENCHMARK_TYPE=$2
shift 2
else
echo "Error: --benchmark-type requires a value"
exit 1
fi
;;
-q|--queries)
if [[ -n $2 ]]; then
QUERIES=$2
shift 2
else
echo "Error: --queries requires a value"
exit 1
fi
;;
-k|--keep-tables)
KEEP_TABLES=true
shift
;;
-h|--hostname)
if [[ -n $2 ]]; then
HOST_NAME=$2
shift 2
else
echo "Error: --hostname requires a value"
exit 1
fi
;;
-p|--port)
if [[ -n $2 ]]; then
PORT=$2
shift 2
else
echo "Error: --port requires a value"
exit 1
fi
;;
-u|--user)
if [[ -n $2 ]]; then
USER=$2
shift 2
else
echo "Error: --user requires a value"
exit 1
fi
;;
-s|--schema-name)
if [[ -n $2 ]]; then
SCHEMA_NAME=$2
shift 2
else
echo "Error: --schema-name requires a value"
exit 1
fi
;;
-f|--scale-factor)
if [[ -n $2 ]]; then
SCALE_FACTOR=$2
shift 2
else
echo "Error: --scale-factor requires a value"
exit 1
fi
;;
*)
echo "Error: Unknown argument $1"
print_help
exit 1
;;
esac
done
}
source ../../scripts/helper_functions.sh

declare -A OPTION_MAP=( ["-b"]="--benchmark-type"
["-q"]="--queries"
["-h"]="--hostname"
["-p"]="--port"
["-u"]="--user"
["-s"]="--schema-name"
["-f"]="--scale-factor" )
make_options "OPTION_MAP"

declare -A FLAG_MAP=( ["-k"]="--keep-tables" )
make_flags "FLAG_MAP"

parse_args "$@"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,44 +57,18 @@ if [[ -z $PRESTO_DATA_DIR ]]; then
exit 1
fi

source ./common_functions.sh
source ../../scripts/helper_functions.sh

wait_for_worker_node_registration
declare -A OPTION_MAP=( ["-b"]="--benchmark-type"
["-d"]="--data-dir-name"
["-s"]="--schema-name" )
make_options "OPTION_MAP"

parse_args() {
custom_parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
print_help
exit 0
;;
-b|--benchmark-type)
if [[ -n $2 ]]; then
BENCHMARK_TYPE=$2
shift 2
else
echo "Error: --benchmark-type requires a value"
exit 1
fi
;;
-s|--schema-name)
if [[ -n $2 ]]; then
SCHEMA_NAME=$2
shift 2
else
echo "Error: --schema-name requires a value"
exit 1
fi
;;
-d|--data-dir-name)
if [[ -n $2 ]]; then
DATA_DIR_NAME=$2
shift 2
else
echo "Error: --data-dir-name requires a value"
exit 1
fi
;;
-h|--help) print_help; exit 0;;
$OPTIONS) parse_option $1 $2; shift 2;;
-c|--convert-decimals-to-floats)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left this one in since it sets it's variable to a custom value, rather than "TRUE"

CONVERT_DECIMALS_TO_FLOATS_ARG="--convert-decimals-to-floats"
shift
Expand All @@ -118,7 +92,11 @@ parse_args() {
done
}

parse_args "$@"
custom_parse_args "$@"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved argument parsing before waiting on worker node so the user can use functions like "--help" without having to wait for a worker registration.


source ./common_functions.sh

wait_for_worker_node_registration

if [[ -z ${BENCHMARK_TYPE} || ! ${BENCHMARK_TYPE} =~ ^tpc(h|ds)$ ]]; then
echo "Error: A valid benchmark type (tpch or tpcds) is required. Use the -b or --benchmark-type argument."
Expand Down
4 changes: 2 additions & 2 deletions presto/scripts/start_presto_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

set -e

source ./start_presto_helper_parse_args.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this up so the user can use "--help" before running into the ENV variable validation.


if [[ -z ${VARIANT_TYPE} || ! ${VARIANT_TYPE} =~ ^(cpu|gpu|java)$ ]]; then
echo "Internal error: A valid variant type (cpu, gpu, or java) is required. Set VARIANT_TYPE to an appropriate value."
exit 1
Expand All @@ -29,8 +31,6 @@ fi
# Validate repo layout using shared script
../../scripts/validate_directories_exist.sh "../../../presto" "../../../velox"

source ./start_presto_helper_parse_args.sh

COORDINATOR_SERVICE="presto-coordinator"
COORDINATOR_IMAGE=${COORDINATOR_SERVICE}:latest
JAVA_WORKER_SERVICE="presto-java-worker"
Expand Down
45 changes: 11 additions & 34 deletions presto/scripts/start_presto_helper_parse_args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,48 +44,25 @@ EOF

NUM_THREADS=$(($(nproc) / 2))

parse_args() {
source ../../scripts/helper_functions.sh
declare -A OPTION_MAP=( ["-b"]="--build-target" ["-j"]="--num-threads" )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed --build to --build-target to match up with the variable being set.

make_options "OPTION_MAP"

custom_parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
print_help
exit 0
;;
-n|--no-cache)
SKIP_CACHE_ARG="--no-cache"
shift
;;
-b|--build)
if [[ -n $2 ]]; then
BUILD_TARGET=$2
shift 2
else
echo "Error: --build requires a value"
exit 1
fi
;;
-j|--num-threads)
if [[ -n $2 ]]; then
NUM_THREADS=$2
shift 2
else
echo "Error: --num-threads requires a value"
exit 1
fi
;;
*)
echo "Error: Unknown argument $1"
print_help
exit 1
;;
-h|--help) print_help; exit 0 ;;
-n|--no-cache) SKIP_CACHE_ARG="--no-cache"; shift ;;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left custom in.

$OPTIONS) parse_option $1 $2; shift 2 ;;
*) echo "Error: Unknown argument $1"; print_help; exit 1 ;;
esac
done
}

parse_args "$@"
custom_parse_args "$@"

if [[ -n ${BUILD_TARGET} && ! ${BUILD_TARGET} =~ ^(coordinator|c|worker|w|all|a)$ ]]; then
echo "Error: invalid --build value."
echo "Error: invalid --build-target value."
print_help
exit 1
fi
Expand Down
43 changes: 10 additions & 33 deletions presto/testing/integration_tests/scripts/generate_test_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,49 +47,26 @@ EOF
SCALE_FACTOR=0.01
CONVERT_DECIMALS_TO_FLOATS=false

parse_args() {
source ../../scripts/helper_functions.sh
declare -A OPTION_MAP=( ["-b"]="--benchmark-type" ["-f"]="--scale-factor" )
make_options "OPTION_MAP"

custom_parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
print_help
exit 0
;;
-b|--benchmark-type)
if [[ -n $2 ]]; then
BENCHMARK_TYPE=$2
shift 2
else
echo "Error: --benchmark-type requires a value"
exit 1
fi
;;
-s|--scale-factor)
if [[ -n $2 ]]; then
SCALE_FACTOR=$2
shift 2
else
echo "Error: --scale-factor requires a value"
exit 1
fi
;;
-h|--help) print_help; exit 0 ;;
$OPTIONS) parse_option $1 $2; shift 2;;
-c|--convert-decimals-to-floats)
CONVERT_DECIMALS_TO_FLOATS=true
shift
;;
-v|--verbose)
VERBOSE="--verbose"
shift
;;
*)
echo "Error: Unknown argument $1"
print_help
exit 1
;;
-v|--verbose) VERBOSE="--verbose"; shift ;;
*) echo "Error: Unknown argument $1"; print_help; exit 1;;
esac
done
}

parse_args "$@"
custom_parse_args "$@"

if [[ -z $BENCHMARK_TYPE ]]; then
BENCHMARK_TYPES_TO_GENERATE=("tpch" "tpcds")
Expand Down
Loading