-
Notifications
You must be signed in to change notification settings - Fork 4
Misiug/multi node docker containers #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0ad9ed7
a496b61
4a21359
bf7ac7d
0d33647
52a4755
ae18cea
d265e0b
6753aea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,7 @@ function conditionally_add_build_target() { | |
| echo "Added $2 to the list of services to build because the '$BUILD_TARGET' build target was specified" | ||
| BUILD_TARGET_ARG+=($2) | ||
| fi | ||
| } | ||
| } | ||
|
|
||
| conditionally_add_build_target $COORDINATOR_IMAGE $COORDINATOR_SERVICE "coordinator|c" | ||
|
|
||
|
|
@@ -130,4 +130,86 @@ if (( ${#BUILD_TARGET_ARG[@]} )); then | |
| ${BUILD_TARGET_ARG[@]} | ||
| fi | ||
|
|
||
| function generate_worker_config() { | ||
| local worker_id=$1 | ||
| local worker_config="../docker/config/generated/gpu/etc_worker_${worker_id}" | ||
| rm -rf ${worker_config} | ||
| # We are duplicating the config generated by pbench, | ||
| # but need to modify it for multi-worker execution. | ||
| cp -r ../docker/config/generated/gpu/etc_worker ${worker_config} | ||
|
|
||
| # Disable single-execution mode. | ||
| sed -i "s+single-node-execution-enabled.*+single-node-execution-enabled=false+g" \ | ||
| ${worker_config}/config_native.properties | ||
|
|
||
| # Give each worker a unique id. | ||
| sed -i "s+node\.id.*+node\.id=worker_${worker_id}+g" ${worker_config}/node.properties | ||
| } | ||
|
|
||
| function generate_worker_service() { | ||
| # These variables were created so that we have more fine-grain control over the naming | ||
| # of services and files (so we don't have to change legacy names for 1-worker setup) | ||
| local worker_suffix="$1" | ||
| local file_suffix="$2" | ||
| local worker_gpu="$3" | ||
|
|
||
| cat >> "$DOCKER_COMPOSE_FILE_PATH" <<YAML | ||
|
|
||
| presto-native-worker-gpu${worker_suffix}: | ||
| extends: | ||
| file: docker-compose.common.yml | ||
| service: presto-base-native-worker | ||
| container_name: presto-native-worker-gpu${worker_suffix} | ||
| image: presto-native-worker-gpu:latest | ||
| build: | ||
| args: | ||
| - GPU=ON | ||
| runtime: nvidia | ||
| environment: | ||
| - NVIDIA_VISIBLE_DEVICES=${worker_gpu} | ||
| - PROFILE=\${PROFILE} | ||
| - PROFILE_ARGS=\${PROFILE_ARGS} | ||
| depends_on: | ||
| - presto-coordinator | ||
| volumes: | ||
| - ./config/generated/gpu/etc_common:/opt/presto-server/etc | ||
| - ./config/generated/gpu/etc_worker${file_suffix}/node.properties:/opt/presto-server/etc/node.properties | ||
| - ./config/generated/gpu/etc_worker${file_suffix}/config_native.properties:/opt/presto-server/etc/config.properties | ||
| YAML | ||
| } | ||
|
|
||
| function generate_coordinator_service() { | ||
| # Start the override file | ||
| cat > "$DOCKER_COMPOSE_FILE_PATH" <<YAML | ||
| services: | ||
| presto-coordinator: | ||
| extends: | ||
| file: docker-compose.common.yml | ||
| service: presto-base-coordinator | ||
| volumes: | ||
| - ./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 | ||
| YAML | ||
| } | ||
|
|
||
| function generate_worker_compose() { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've changed the setup so that the docker-compose.native-gpu file is always generated/overwritten based on the number of workers. If NUM_WORKERS is not specified, or is "1", then it should generate exactly what was there before. If NUM_WORKERS > 1 then it will generate separate services for each worker. |
||
| generate_coordinator_service | ||
|
|
||
| if [[ "$NUM_WORKERS" -gt "1" ]]; then | ||
| # Generate NUM_WORKERS services, each with one gpu. | ||
| for i in $(seq 0 $((NUM_WORKERS-1))); do | ||
| generate_worker_service "-$i" "_$i" "$i" | ||
| generate_worker_config $i | ||
| done | ||
| else | ||
| # Generate one worker service with access to all gpus | ||
| generate_worker_service "" "" "all" | ||
| fi | ||
| } | ||
|
|
||
| if [[ "$VARIANT_TYPE" == "gpu" ]]; then | ||
| generate_worker_compose | ||
| fi | ||
|
|
||
| docker compose -f $DOCKER_COMPOSE_FILE_PATH up -d | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this was correct before; as we were referring to the coordinator's config as worker_config.