From 10f8506f4f4d90e12c69f7e8e892d2e4d3e68fb4 Mon Sep 17 00:00:00 2001 From: Alex Iankoulski Date: Mon, 1 Jul 2024 15:31:21 -0400 Subject: [PATCH] Add default verbose mode --- 0-provision/stack-create.sh | 9 +++++- 1-build/pull.sh | 7 ++++- 1-build/push.sh | 13 +++++++-- 3-pack/pull.sh | 7 ++++- 3-pack/push.sh | 13 +++++++-- 4-deploy/exec.sh | 12 ++++++-- 4-deploy/generate-yaml.sh | 8 ++++-- 4-deploy/logs.sh | 15 ++++++---- 4-deploy/run.sh | 12 ++++++-- 4-deploy/status.sh | 32 ++++++++++++++++----- 4-deploy/stop.sh | 13 +++++++-- 5-test/build.sh | 7 +++-- 5-test/exec.sh | 11 +++---- 5-test/generate-yaml.sh | 8 ++++-- 5-test/logs.sh | 11 ++++--- 5-test/pull.sh | 7 ++++- 5-test/push.sh | 13 +++++++-- 5-test/run.sh | 32 +++++++++++++++------ 5-test/status.sh | 13 +++++---- 5-test/stop.sh | 14 ++++++--- 6-remove/{cfn-delete.sh => stack-delete.sh} | 12 ++++++++ build.sh | 9 +++--- config.properties | 3 ++ config.sh | 6 +++- login.sh | 6 +++- pack.sh | 11 +++---- remove.sh | 2 +- trace.sh | 9 +++--- 28 files changed, 229 insertions(+), 86 deletions(-) rename 6-remove/{cfn-delete.sh => stack-delete.sh} (92%) diff --git a/0-provision/stack-create.sh b/0-provision/stack-create.sh index 8e5bafb..658fc82 100755 --- a/0-provision/stack-create.sh +++ b/0-provision/stack-create.sh @@ -1,4 +1,11 @@ #!/bin/bash -aws cloudformation create-stack --stack-name ManagementInstance --template-body file://ManagementInstance.json --capabilities CAPABILITY_IAM +source ../config.properties + +CMD="aws cloudformation create-stack --stack-name ManagementInstance --template-body file://ManagementInstance.json --capabilities CAPABILITY_IAM" + +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" diff --git a/1-build/pull.sh b/1-build/pull.sh index c4a0a1d..6401f97 100755 --- a/1-build/pull.sh +++ b/1-build/pull.sh @@ -15,4 +15,9 @@ else echo "config.properties not found!" fi -docker pull ${registry}${base_image_name}${base_image_tag} +CMD="docker pull ${registry}${base_image_name}${base_image_tag}" +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/1-build/push.sh b/1-build/push.sh index f9b4e6f..1b67445 100755 --- a/1-build/push.sh +++ b/1-build/push.sh @@ -20,7 +20,16 @@ fi IMAGE=${base_image_name} REGISTRY_COUNT=$(aws ecr describe-repositories | grep ${IMAGE} | wc -l) if [ "$REGISTRY_COUNT" == "0" ]; then - aws ecr create-repository --repository-name ${IMAGE} --region ${region} + CMD="aws ecr create-repository --repository-name ${IMAGE} --region ${region}" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" fi -docker push ${registry}${base_image_name}${base_image_tag} +CMD="docker push ${registry}${base_image_name}${base_image_tag}" +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/3-pack/pull.sh b/3-pack/pull.sh index a6b0888..b931194 100755 --- a/3-pack/pull.sh +++ b/3-pack/pull.sh @@ -15,4 +15,9 @@ else echo "config.properties not found!" fi -docker pull ${registry}${model_image_name}${model_image_tag} +CMD="docker pull ${registry}${model_image_name}${model_image_tag}" +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/3-pack/push.sh b/3-pack/push.sh index 5443474..f7eb4b9 100755 --- a/3-pack/push.sh +++ b/3-pack/push.sh @@ -20,7 +20,16 @@ fi IMAGE=${model_image_name} REGISTRY_COUNT=$(aws ecr describe-repositories | grep ${IMAGE} | wc -l) if [ "$REGISTRY_COUNT" == "0" ]; then - aws ecr create-repository --repository-name ${IMAGE} --region ${region} + CMD="aws ecr create-repository --repository-name ${IMAGE} --region ${region}" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" fi -docker push ${registry}${model_image_name}${model_image_tag} +CMD="docker push ${registry}${model_image_name}${model_image_tag}" +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/4-deploy/exec.sh b/4-deploy/exec.sh index 7edb28f..a4a974e 100755 --- a/4-deploy/exec.sh +++ b/4-deploy/exec.sh @@ -19,10 +19,16 @@ echo "Processor: $processor" if [ "$runtime" == "docker" ]; then CMD="docker exec -it ${app_name}-0 bash" - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" elif [ "$runtime" == "kubernetes" ]; then - kubectl -n ${namespace} exec -it $(kubectl -n ${namespace} get pod | grep ${app_name}-$1 | cut -d ' ' -f 1) -- bash + CMD="kubectl -n ${namespace} exec -it $(kubectl -n ${namespace} get pod | grep ${app_name}-$1 | cut -d ' ' -f 1) -- bash" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" else echo "Runtime $runtime not recognized" fi diff --git a/4-deploy/generate-yaml.sh b/4-deploy/generate-yaml.sh index b256f9d..2c27dae 100755 --- a/4-deploy/generate-yaml.sh +++ b/4-deploy/generate-yaml.sh @@ -31,9 +31,11 @@ do export instance_name=${prefix}${instance} echo "Generating ./${app_dir}/${instance_name}.yaml ..." CMD="cat $template | envsubst > ./${app_dir}/${instance_name}.yaml" - #echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" instance=$((instance+1)) done -set +a \ No newline at end of file +set +a diff --git a/4-deploy/logs.sh b/4-deploy/logs.sh index 5a97f0e..6b61808 100755 --- a/4-deploy/logs.sh +++ b/4-deploy/logs.sh @@ -17,6 +17,7 @@ echo "" echo "Runtime: $runtime" echo "Processor: $processor" +CMD="" if [ "$runtime" == "docker" ]; then if [ "$num_servers" == "1" ]; then CMD="docker logs -f ${app_name}-0" @@ -27,8 +28,6 @@ if [ "$runtime" == "docker" ]; then CMD="docker logs -f ${app_name}-$1" fi fi - echo "$CMD" - eval "$CMD" elif [ "$runtime" == "kubernetes" ]; then command -v kubetail > /dev/null if [ "$?" == "1" ]; then @@ -36,11 +35,17 @@ elif [ "$runtime" == "kubernetes" ]; then echo "Please follow the instructions here https://github.com/johanhaleby/kubetail#installation, then try again" else if [ "$1" == "" ]; then - kubetail -n ${namespace} -f ${app_name} + CMD="kubetail -n ${namespace} -f ${app_name}" else - kubectl -n ${namespace} logs -f $(kubectl -n ${namespace} get pods | grep ${app_name}-$1 | cut -d ' ' -f 1) + CMD="kubectl -n ${namespace} logs -f $(kubectl -n ${namespace} get pods | grep ${app_name}-$1 | cut -d ' ' -f 1)" fi fi else echo "Runtime $runtime not recognized" -fi \ No newline at end of file +fi + +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/4-deploy/run.sh b/4-deploy/run.sh index 2bae794..1be1f00 100755 --- a/4-deploy/run.sh +++ b/4-deploy/run.sh @@ -28,14 +28,20 @@ if [ "$runtime" == "docker" ]; then run_opts="--device=/dev/neuron${server} ${run_opts}" fi CMD="docker run -d ${run_opts} ${registry}${model_image_name}${model_image_tag}" - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" server=$((server+1)) done elif [ "$runtime" == "kubernetes" ]; then kubectl create namespace ${namespace} --dry-run=client -o yaml | kubectl apply -f - ./generate-yaml.sh - kubectl apply -f ${app_dir} + CMD="kubectl apply -f ${app_dir}" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" else echo "Runtime $runtime not recognized" fi diff --git a/4-deploy/status.sh b/4-deploy/status.sh index bf90b4f..bab33b4 100755 --- a/4-deploy/status.sh +++ b/4-deploy/status.sh @@ -19,24 +19,42 @@ echo "Processor: $processor" if [ "$runtime" == "docker" ]; then CMD="docker ps -a | grep ${app_name}" - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" elif [ "$runtime" == "kubernetes" ]; then if [ "$1" == "" ]; then + CMD="kubectl -n ${namespace} get pods" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi echo "" echo "Pods:" - kubectl -n ${namespace} get pods + eval "${CMD}" + CMD="kubectl -n ${namespace} get services" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi echo "" echo "Services:" - kubectl -n ${namespace} get services + eval "${CMD}" else + CMD="kubectl -n ${namespace} get pod $(kubectl -n ${namespace} get pods | grep ${app_name}-$1 | cut -d ' ' -f 1) -o wide" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi echo "" echo "Pod:" - kubectl -n ${namespace} get pod $(kubectl -n ${namespace} get pods | grep ${app_name}-$1 | cut -d ' ' -f 1) -o wide + eval "${CMD}" + CMD="kubectl -n ${namespace} get service ${app_name}-$1" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi echo "" echo "Service:" - kubectl -n ${namespace} get service ${app_name}-$1 + eval "${CMD}" fi else echo "Runtime $runtime not recognized" -fi \ No newline at end of file +fi diff --git a/4-deploy/stop.sh b/4-deploy/stop.sh index 91c9d2d..c1ee2ca 100755 --- a/4-deploy/stop.sh +++ b/4-deploy/stop.sh @@ -21,12 +21,19 @@ if [ "$runtime" == "docker" ]; then server=0 while [ $server -lt $num_servers ]; do CMD="docker rm -f ${app_name}-${server}" - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" server=$((server+1)) done elif [ "$runtime" == "kubernetes" ]; then - kubectl delete -f ${app_dir} + CMD="kubectl delete -f ${app_dir}" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" else echo "Runtime $runtime not recognized" fi + diff --git a/5-test/build.sh b/5-test/build.sh index e59f2cf..c75e1da 100755 --- a/5-test/build.sh +++ b/5-test/build.sh @@ -16,5 +16,8 @@ fi #use CMD variable for better debugging CMD="docker build -t ${registry}${test_image_name}${test_image_tag} --build-arg BASE_IMAGE=${registry}${base_image_name}${base_image_tag} \ -f 5-test/Dockerfile ." -eval $CMD - +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/5-test/exec.sh b/5-test/exec.sh index 6a064a6..6e7f9d9 100755 --- a/5-test/exec.sh +++ b/5-test/exec.sh @@ -28,8 +28,6 @@ if [ "$runtime" == "docker" ]; then CMD="docker exec -it ${test_image_name}-$1 bash" fi fi - echo "$CMD" - eval "$CMD" elif [ "$runtime" == "kubernetes" ]; then if [ "$num_test_containers" == "1" ]; then CMD="kubectl -n ${test_namespace} exec -it $(kubectl -n ${test_namespace} get pod | grep ${test_image_name}-0 | cut -d ' ' -f 1) -- bash" @@ -41,8 +39,11 @@ elif [ "$runtime" == "kubernetes" ]; then CMD="kubectl -n ${test_namespace} exec -it $(kubectl -n ${test_namespace} get pod | grep ${test_image_name}-$1 | cut -d ' ' -f 1) -- bash" fi fi - echo "$CMD" - eval "$CMD" else echo "Runtime $runtime not recognized" -fi \ No newline at end of file +fi +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/5-test/generate-yaml.sh b/5-test/generate-yaml.sh index 3a7c832..aa8dfe1 100755 --- a/5-test/generate-yaml.sh +++ b/5-test/generate-yaml.sh @@ -37,9 +37,11 @@ do export instance_name=${prefix}${instance} echo "Generating ./${test_dir}/${instance_name}.yaml ..." CMD="cat $template | envsubst > ./${test_dir}/${instance_name}.yaml" - #echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" instance=$((instance+1)) done -set +a \ No newline at end of file +set +a diff --git a/5-test/logs.sh b/5-test/logs.sh index b20d845..d275d70 100755 --- a/5-test/logs.sh +++ b/5-test/logs.sh @@ -27,14 +27,17 @@ if [ "$runtime" == "docker" ]; then CMD="docker logs -f ${test_image_name}-$1" fi fi - echo "$CMD" - eval "$CMD" elif [ "$runtime" == "kubernetes" ]; then if [ "$1" == "" ]; then - kubectl -n ${test_namespace} get pods | grep ${test_image_name}- | cut -d ' ' -f 1 | xargs -L 1 kubectl -n ${test_namespace} logs + CMD="kubectl -n ${test_namespace} get pods | grep ${test_image_name}- | cut -d ' ' -f 1 | xargs -L 1 kubectl -n ${test_namespace} logs" else - kubectl -n ${test_namespace} logs -f $(kubectl -n ${test_namespace} get pods | grep ${test_image_name}-$1 | cut -d ' ' -f 1) + CMD="kubectl -n ${test_namespace} logs -f $(kubectl -n ${test_namespace} get pods | grep ${test_image_name}-$1 | cut -d ' ' -f 1)" fi else echo "Runtime $runtime not recognized" fi +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/5-test/pull.sh b/5-test/pull.sh index 8917e20..eeae9d0 100755 --- a/5-test/pull.sh +++ b/5-test/pull.sh @@ -15,4 +15,9 @@ else echo "config.properties not found!" fi -docker pull ${registry}${test_image_name}${test_image_tag} +CMD="docker pull ${registry}${test_image_name}${test_image_tag}" +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/5-test/push.sh b/5-test/push.sh index b1f8de3..e716d3d 100755 --- a/5-test/push.sh +++ b/5-test/push.sh @@ -20,7 +20,16 @@ fi IMAGE=${test_image_name} REGISTRY_COUNT=$(aws ecr describe-repositories | grep ${IMAGE} | wc -l) if [ "$REGISTRY_COUNT" == "0" ]; then - aws ecr create-repository --repository-name ${IMAGE} --region ${region} + CMD="aws ecr create-repository --repository-name ${IMAGE} --region ${region}" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" fi -docker push ${registry}${test_image_name}${test_image_tag} +CMD="docker push ${registry}${test_image_name}${test_image_tag}" +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/5-test/run.sh b/5-test/run.sh index a93f539..28f5b7a 100755 --- a/5-test/run.sh +++ b/5-test/run.sh @@ -26,8 +26,10 @@ if [ "$runtime" == "docker" ]; then echo "bc not found" echo "Please 'sudo apt-get install -y bc' or 'sudo yum install -y bc', then try again" else - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" ./aggregate.sh ./bmk-all.log fi rm -f ./bmk-all.log @@ -49,9 +51,11 @@ if [ "$runtime" == "docker" ]; then CMD="$CMD bash -c 'pushd /app/tests && ./curl-rnd-ip.sh'" elif [ "$1" == "bmk" ]; then CMD="$CMD bash -c 'pushd /app/tests && ./benchmark.sh'" - fi - echo "$CMD" - eval "$CMD" + fi + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" test_container=$((test_container+1)) done fi @@ -64,13 +68,19 @@ elif [ "$runtime" == "kubernetes" ]; then echo "bc not found" echo "Please 'sudo apt-get install -y bc' or 'sudo yum install -y bc', then try again" else - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" ./aggregate.sh ./bmk-all.log fi rm -f ./bmk-all.log else - kubectl create namespace ${test_namespace} --dry-run=client -o yaml | kubectl apply -f - + CMD="kubectl create namespace ${test_namespace} --dry-run=client -o yaml | kubectl apply -f -" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" cmd_pod="while true; do date; sleep 10; done" template="./deployment-yaml.template" if [ "$1" == "seq" ]; then @@ -86,7 +96,11 @@ elif [ "$runtime" == "kubernetes" ]; then echo "export cmd_pod=\"$cmd_pod\"" > cmd_pod.properties echo "export template=$template" >> cmd_pod.properties eval "./generate-yaml.sh" - kubectl apply -f ${test_dir} + CMD="kubectl apply -f ${test_dir}" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" fi popd > /dev/null else diff --git a/5-test/status.sh b/5-test/status.sh index 9fc556a..ceb0657 100755 --- a/5-test/status.sh +++ b/5-test/status.sh @@ -19,18 +19,21 @@ echo "Processor: $processor" if [ "$runtime" == "docker" ]; then CMD="docker ps -a | grep ${test_image_name}-" - echo "$CMD" - eval "$CMD" elif [ "$runtime" == "kubernetes" ]; then if [ "$1" == "" ]; then echo "" echo "Pods:" - kubectl -n ${test_namespace} get pods + CMD="kubectl -n ${test_namespace} get pods" else echo "" echo "Pod:" - kubectl -n ${test_namespace} get pod $(kubectl -n ${test_namespace} get pods | grep ${test_image_name}-$1 | cut -d ' ' -f 1) -o wide + CMD="kubectl -n ${test_namespace} get pod $(kubectl -n ${test_namespace} get pods | grep ${test_image_name}-$1 | cut -d ' ' -f 1) -o wide" fi else echo "Runtime $runtime not recognized" -fi \ No newline at end of file +fi +if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" +fi +eval "${CMD}" + diff --git a/5-test/stop.sh b/5-test/stop.sh index f9b973a..20c29e7 100755 --- a/5-test/stop.sh +++ b/5-test/stop.sh @@ -22,8 +22,10 @@ if [ "$runtime" == "docker" ]; then test_container=0 while [ $test_container -lt $num_test_containers ]; do CMD="docker rm -f ${test_image_name}-${test_container}" - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" test_container=$((test_container+1)) done else @@ -33,8 +35,12 @@ if [ "$runtime" == "docker" ]; then fi elif [ "$runtime" == "kubernetes" ]; then pushd ./5-test > /dev/null - kubectl delete -f ${test_dir} + CMD="kubectl delete -f ${test_dir}" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" popd > /dev/null else echo "Runtime $runtime not recognized" -fi \ No newline at end of file +fi diff --git a/6-remove/cfn-delete.sh b/6-remove/stack-delete.sh similarity index 92% rename from 6-remove/cfn-delete.sh rename to 6-remove/stack-delete.sh index cf08896..0aeefe6 100755 --- a/6-remove/cfn-delete.sh +++ b/6-remove/stack-delete.sh @@ -1,5 +1,14 @@ #!/bin/bash +pushd .. +if [ -f ./config.properties ]; then + source ./config.properties +fi + +if [ ! "$verbose" == "false" ]; then + set -x +fi + echo "" echo "Deleting node groups, IAM service account and EKS cluster eksctl-eks-inference-workshop ..." aws cloudformation delete-stack --stack-name eksctl-eks-inference-workshop-nodegroup-inf --region us-west-2 @@ -18,7 +27,10 @@ echo "Finished deletion of eksctl-eks-inference-workshop CF stack in us-west-2 r aws cloudformation delete-stack --stack-name ManagementInstance aws cloudformation wait stack-delete-complete --stack-name ManagementInstance +set +x + echo "" echo "Cleanup of all ML Inference Guidance AWS Resources complete" echo "" + diff --git a/build.sh b/build.sh index ba8d662..f205f7d 100755 --- a/build.sh +++ b/build.sh @@ -31,12 +31,11 @@ if [ "$action" == "" ]; then dockerfile=./1-build/Dockerfile-base-${processor} if [ -f $dockerfile ]; then echo " ... base-${processor} ..." - # docker build -t ${registry}${base_image_name}${base_image_tag} -f $dockerfile . - # refactor docker build command into designated variable for ease of debugging and changes CMD="docker build -t ${registry}${base_image_name}${base_image_tag} -f $dockerfile ." - echo "will run command: " - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" else echo "Dockerfile $dockerfile was not found." echo "Please ensure that processor is configured with a supported value in config.properties" diff --git a/config.properties b/config.properties index cd8a694..3c8ac45 100644 --- a/config.properties +++ b/config.properties @@ -8,6 +8,9 @@ # SPDX-License-Identifier: MIT-0 # ###################################################################### +# Project settings +verbose=true + # Model settings huggingface_model_name=bert-base-multilingual-cased huggingface_tokenizer_class=BertTokenizer diff --git a/config.sh b/config.sh index 66e73f6..b062f00 100755 --- a/config.sh +++ b/config.sh @@ -16,7 +16,11 @@ print_help() { } if [ "$1" == "" ]; then - vi ./config.properties + CMD="vi ./config.properties" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" else print_help fi diff --git a/login.sh b/login.sh index 6ffb69b..033c554 100755 --- a/login.sh +++ b/login.sh @@ -30,7 +30,11 @@ if [ "$1" == "" ]; then case "$registry_type" in "ecr") echo "Logging in to $registry_type $registry ..." - aws ecr get-login-password --region $region | docker login --username AWS --password-stdin $registry + CMD="aws ecr get-login-password --region $region | docker login --username AWS --password-stdin $registry" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" ;; *) echo "Login for registry_type=$registry_type is not implemented" diff --git a/pack.sh b/pack.sh index 547913b..386fe65 100755 --- a/pack.sh +++ b/pack.sh @@ -27,16 +27,13 @@ action=$1 if [ "$action" == "" ]; then model_file_name=${huggingface_model_name}_bs${batch_size}_seq${sequence_length}_pc${pipeline_cores}_${processor}.pt - # docker build -t ${registry}${model_image_name}${model_image_tag} --build-arg BASE_IMAGE=${registry}${base_image_name}${base_image_tag} \ - # --build-arg MODEL_NAME=${huggingface_model_name} --build-arg MODEL_FILE_NAME=${model_file_name} --build-arg PROCESSOR=${processor} \ - # -f 3-pack/Dockerfile . - # move commands into special variables for ease of maintenance: CMD="docker build -t ${registry}${model_image_name}${model_image_tag} --build-arg BASE_IMAGE=${registry}${base_image_name}${base_image_tag} \ --build-arg MODEL_NAME=${huggingface_model_name} --build-arg MODEL_FILE_NAME=${model_file_name} --build-arg PROCESSOR=${processor} \ -f 3-pack/Dockerfile ." - echo "will run command: " - echo "$CMD" - eval "$CMD" + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" elif [ "$action" == "push" ]; then ./3-pack/push.sh elif [ "$action" == "pull" ]; then diff --git a/remove.sh b/remove.sh index 1da24f9..3c613e0 100755 --- a/remove.sh +++ b/remove.sh @@ -30,7 +30,7 @@ if [ "$runtime" == "kubernetes" ]; then echo "" pushd ./6-remove - ./cfn-delete.sh + ./stack-delete.sh popd elif [ "$runtime" == "docker" ]; then echo "" diff --git a/trace.sh b/trace.sh index 1c3f0e9..3f0e9a3 100755 --- a/trace.sh +++ b/trace.sh @@ -26,12 +26,11 @@ if [ "$1" == "" ]; then if [ -f $dockerfile ]; then echo " ... for processor: $processor ..." trace_opts=trace_opts_${processor} - # move commands into special variables for ease of maintenance: CMD="docker run ${!trace_opts} -it --rm -v $(pwd)/2-trace:/app/trace -v $(pwd)/config.properties:/app/config.properties ${registry}${base_image_name}${base_image_tag} bash -c 'cd /app/trace; python --version; python model-tracer.py'" - echo "will run command: " - echo "$CMD" - eval "$CMD" - + if [ ! "$verbose" == "false" ]; then + echo "\n${CMD}\n" + fi + eval "${CMD}" else echo "Processor $processor is not supported. Please ensure the processor setting in config.properties is configured properly" exit 1