Skip to content
Merged
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
6 changes: 0 additions & 6 deletions presto/docker/docker-compose.common.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
services:
presto-base-volumes:
volumes:
- ./config/generated/etc_common:/opt/presto-server/etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Each of the three variants now has a separate generated config tree, so ALL of the mappings have to move to the leaf container recipes.

- ./.hive_metastore:/var/lib/presto/data/hive/metastore
- ../testing/integration_tests/data:/var/lib/presto/data/hive/data/integration_test
- ${PRESTO_DATA_DIR:-/dev/null}:/var/lib/presto/data/hive/data/user_data
Expand All @@ -19,8 +18,6 @@ services:
image: presto-coordinator:latest
ports:
- 8080:8080
volumes:
- ./config/generated/etc_coordinator/node.properties:/opt/presto-server/etc/node.properties

presto-base-native-worker:
extends:
Expand All @@ -30,6 +27,3 @@ services:
dockerfile: velox-testing/presto/docker/native_build.dockerfile
environment:
- GLOG_logtostderr=1
volumes:
- ./config/generated/etc_worker/node.properties:/opt/presto-server/etc/node.properties
- ./config/generated/etc_worker/config_native.properties:/opt/presto-server/etc/config.properties
9 changes: 6 additions & 3 deletions presto/docker/docker-compose.java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ services:
file: docker-compose.common.yml
service: presto-base-coordinator
volumes:
- ./config/generated/etc_coordinator/config_java.properties:/opt/presto-server/etc/config.properties
- ./config/generated/java/etc_common:/opt/presto-server/etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am assuming that order is important here, to ensure that the behavior is still to map the directory and THEN map some of the individual files (to somewhere else), same as when the directory mapping was in the parent recipe.

- ./config/generated/java/etc_coordinator/config_java.properties:/opt/presto-server/etc/config.
- ./config/generated/java/etc_coordinator/node.properties:/opt/presto-server/etc/node.properties

presto-java-worker:
extends:
Expand All @@ -13,7 +15,8 @@ services:
container_name: presto-java-worker
image: presto-java-worker:latest
volumes:
- ./config/generated/etc_worker/config_java.properties:/opt/presto-server/etc/config.properties
- ./config/generated/etc_worker/node.properties:/opt/presto-server/etc/node.properties
- ./config/generated/java/etc_common:/opt/presto-server/etc
- ./config/generated/java/etc_worker/config_java.properties:/opt/presto-server/etc/config.properties
- ./config/generated/java/etc_worker/node.properties:/opt/presto-server/etc/node.properties
depends_on:
- presto-coordinator
8 changes: 7 additions & 1 deletion presto/docker/docker-compose.native-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ services:
file: docker-compose.common.yml
service: presto-base-coordinator
volumes:
- ./config/generated/etc_coordinator/config_native.properties:/opt/presto-server/etc/config.properties
- ./config/generated/cpu/etc_common:/opt/presto-server/etc
- ./config/generated/cpu/etc_coordinator/config_native.properties:/opt/presto-server/etc/config.properties
- ./config/generated/cpu/etc_coordinator/node.properties:/opt/presto-server/etc/node.properties

presto-native-worker-cpu:
extends:
Expand All @@ -17,3 +19,7 @@ services:
- GPU=OFF
depends_on:
- presto-coordinator
volumes:
- ./config/generated/cpu/etc_common:/opt/presto-server/etc
- ./config/generated/cpu/etc_worker/node.properties:/opt/presto-server/etc/node.properties
- ./config/generated/cpu/etc_worker/config_native.properties:/opt/presto-server/etc/config.properties
8 changes: 7 additions & 1 deletion presto/docker/docker-compose.native-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ services:
file: docker-compose.common.yml
service: presto-base-coordinator
volumes:
- ./config/generated/etc_coordinator/config_native.properties:/opt/presto-server/etc/config.properties
- ./config/generated/gpu/etc_common:/opt/presto-server/etc
- ./config/generated/gpu/etc_coordinator/config_native.properties:/opt/presto-server/etc/config.properties
- ./config/generated/gpu/etc_coordinator/node.properties:/opt/presto-server/etc/node.properties

presto-native-worker-gpu:
extends:
Expand All @@ -22,3 +24,7 @@ services:
- PROFILE_ARGS=${PROFILE_ARGS}
depends_on:
- presto-coordinator
volumes:
- ./config/generated/gpu/etc_common:/opt/presto-server/etc
- ./config/generated/gpu/etc_worker/node.properties:/opt/presto-server/etc/node.properties
- ./config/generated/gpu/etc_worker/config_native.properties:/opt/presto-server/etc/config.properties
66 changes: 39 additions & 27 deletions presto/scripts/generate_presto_config.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lsmem may not be available on all environments. Consider adding a fallback (e.g., /proc/meminfo or free -g) so the script works across more hosts.
Example fallback: if command -v lsmem is missing, parse /proc/meminfo or use free -g

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@patdevinwilson do you have an example of a system where lsmem -b does NOT work?

Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,36 @@
set -euo pipefail

RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

function echo_error {
echo -e "${RED}$1${NC}"
exit 1
echo -e "${RED}$1${NC}"
exit 1
}

function echo_warning {
echo -e "${YELLOW}$1${NC}"
}

function echo_success {
echo -e "${GREEN}$1${NC}"
echo -e "${GREEN}$1${NC}"
}

if [ ! -x ../pbench/pbench ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great little check, I'm wondering if we need to broadly apply such checks to all our scripts! (I realize this was not added in this PR but it just gets highlighted, and I think I've previously missed this.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@misiugodfrey perhaps you can implement something equivalent in your script utilities stuff, that can be called from any script to verify that it's being run from the right location.

echo "ERROR: generate_presto_config.sh script must only be run from presto:presto/scripts"
exit 1
echo_error "ERROR: generate_presto_config.sh script must only be run from presto:presto/scripts"
fi

# get host values
NPROC=`nproc`
# lsmem will report in SI. Make sure we get values in GB.
RAM_GB=$(lsmem -b | grep "Total online memory" | awk '{print int($4 / (1024*1024*1024)); }')

echo "Generating Presto Config files for ${NPROC} CPU cores and ${RAM_GB}GB RAM"

# variant-specific behavior
# for GPU you must set vcpu_per_worker to a small number, not the CPU count
if [[ -z ${VARIANT_TYPE} || ! ${VARIANT_TYPE} =~ ^(cpu|gpu|java)$ ]]; then
echo "Error: VARIANT_TYPE must be set to a valid variant type (cpu, gpu, java)."
exit 1
echo_error "ERROR: VARIANT_TYPE must be set to a valid variant type (cpu, gpu, java)."
fi
if [[ "${VARIANT_TYPE}" == "gpu" ]]; then
VCPU_PER_WORKER=2
Expand All @@ -59,10 +60,16 @@ pushd ../docker/config > /dev/null
# always move back even on failure
trap "popd > /dev/null" EXIT

# (re-)generate the config.json file
rm -rf generated
mkdir -p generated
cat > generated/config.json << EOF
CONFIG_DIR=generated/${VARIANT_TYPE}

# generate only if no existing config or overwrite flag is set

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What configurations are being modified locally? Can you please expand on where the request for the updates in the PR is coming from?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@paul-aiyedun Todd and Patrick were both iterating configs by editing their local files. Once the original auto-config PR (#48) landed, this was dangerous, because the config would be automatically re-generated every time you ran the start script, so local speculative edits would be overwritten if you hadn't copied them aside. Hence, they asked for this change.

if [[ ! -d ${CONFIG_DIR} || "${OVERWRITE_CONFIG}" == "true" ]]; then
echo "Generating Presto Config files for '${VARIANT_TYPE}' for host with ${NPROC} CPU cores and ${RAM_GB}GB RAM"

# (re-)generate the config.json file
rm -rf ${CONFIG_DIR}

@mattgara mattgara Oct 30, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this need special handling in case the script fails to complete (i.e. do we need a trap to clean this up?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you mean it should remove any config files it manages to generate if it doesn't generate it PROPERLY? At this point, the only thing that can fail is pbench itself, and if that fails, you get nothing anyway. The server won't start in that situation, so even if something WAS generated, the server won't try to use it, and it'll get deleted again when it next succeeds.

mkdir -p ${CONFIG_DIR}
cat > ${CONFIG_DIR}/config.json << EOF
{
"cluster_size": "small",
"coordinator_instance_type": "${NPROC}-core CPU and ${RAM_GB}GB RAM",
Expand All @@ -77,19 +84,24 @@ cat > generated/config.json << EOF
}
EOF

# run pbench to generate the config files
# hide default pbench logging which goes to stderr so we only see any errors
if ../../pbench/pbench genconfig -p params.json -t template generated 2>&1 | grep '\{\"level":"error"'; then
echo_error "ERROR in pbench genconfig. Configs were not generated successfully"
fi
# run pbench to generate the config files
# hide default pbench logging which goes to stderr so we only see any errors
if ../../pbench/pbench genconfig -p params.json -t template ${CONFIG_DIR} 2>&1 | grep '\{\"level":"error"'; then
echo_error "ERROR: Errors reported by pbench genconfig. Configs were not generated successfully."
fi

# now perform other variant-specific modifications to the generated configs
if [[ "${VARIANT_TYPE}" == "gpu" ]]; then
# for GPU variant, uncomment these optimizer settings
# optimizer.joins-not-null-inference-strategy=USE_FUNCTION_METADATA
# optimizer.default-filter-factor-enabled=true
COORD_CONFIG="generated/etc_coordinator/config_native.properties"
sed -i 's/\#optimizer/optimizer/g' ${COORD_CONFIG}
fi
# now perform other variant-specific modifications to the generated configs
if [[ "${VARIANT_TYPE}" == "gpu" ]]; then
# for GPU variant, uncomment these optimizer settings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Also not added in this PR but just being brought to my attention in this one)

"uncomment these ... when" seems like a perfect fit for an CLI option that enables this (optionally of course!)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this was #111. I don't think this should be a command-line option, as it MUST be enabled for GPU, and MUST NOT be enabled for CPU. This was my latest way of avoiding forking the template files, which @paul-aiyedun and others are opposed to.

# optimizer.joins-not-null-inference-strategy=USE_FUNCTION_METADATA
# optimizer.default-filter-factor-enabled=true
COORD_CONFIG="${CONFIG_DIR}/etc_coordinator/config_native.properties"
sed -i 's/\#optimizer/optimizer/g' ${COORD_CONFIG}
fi

echo_success "Configs were generated successfully"
# success message
echo_success "Configs were generated successfully"
else
# otherwise, reuse existing config
echo_success "Reusing existing Presto Config files for '${VARIANT_TYPE}'"
fi
6 changes: 6 additions & 0 deletions presto/scripts/start_presto_helper_parse_args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ OPTIONS:
-p, --profile Launch the Presto server with profiling enabled.
--profile-args Arguments to pass to the profiler when it launches the Presto server.
This will override the default arguments.
--overwrite-config Force config to be regenerated (will overwrite local changes).

EXAMPLES:
$SCRIPT_NAME --no-cache
Expand All @@ -53,6 +54,7 @@ EOF
NUM_THREADS=$(($(nproc) / 2))
BUILD_TYPE=release
ALL_CUDA_ARCHS=false
export OVERWRITE_CONFIG=false
export PROFILE=OFF
parse_args() {
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -110,6 +112,10 @@ parse_args() {
ALL_CUDA_ARCHS=true
shift
;;
--overwrite-config)
OVERWRITE_CONFIG=true
shift
;;
*)
echo "Error: Unknown argument $1"
print_help
Expand Down
Loading