|
2 | 2 | set -ex
|
3 | 3 | set -o pipefail
|
4 | 4 |
|
| 5 | +CORE_REPO="https://github.com/awslabs/sagemaker-debugger.git" |
| 6 | +RULES_REPO="https://$RULES_ACCESS_USER:$RULES_ACCESS_TOKEN@github.com/awslabs/sagemaker-debugger-rules.git" |
| 7 | +SMDEBUG_S3_BINARY="s3://smdebug-nightly-binaries/$(date +%F)/" |
5 | 8 |
|
6 |
| -cd $CODEBUILD_SRC_DIR |
7 |
| -# you can provide bip binary as s3 path in the build environment |
| 9 | +# Uninstall the built-in version of smdebug and assert that it no longer exists. |
| 10 | +pip uninstall -y smdebug |
| 11 | +#python -c "import smdebug" |
| 12 | + |
| 13 | +code_dir=$(basename "$PWD") |
| 14 | +echo "Cloning sagemaker-debugger repository." |
| 15 | +cd $CODEBUILD_SRC_DIR && cd .. && rm -rf "$code_dir" && git clone "$CORE_REPO" "$code_dir" |
| 16 | +echo "sagemaker-debugger repository cloned in the path $CODEBUILD_SRC_DIR" |
| 17 | + |
| 18 | +cd $CODEBUILD_SRC_DIR_RULES && code_dir=$(basename "$PWD") |
| 19 | +echo "Cloning sagemaker-debugger-rules repository." |
| 20 | +cd $CODEBUILD_SRC_DIR_RULES && cd .. && rm -rf "$code_dir" && git clone "$RULES_REPO" "$code_dir" |
| 21 | +echo "sagemaker-debugger-rules repository cloned in the path $CODEBUILD_SRC_DIR_RULES" |
| 22 | +export RULES_CODEBUILD_SRC_DIR="$CODEBUILD_SRC_DIR_RULES" |
| 23 | + |
| 24 | +export CODEBUILD_ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text) |
| 25 | +export CODEBUILD_PROJECT=${CODEBUILD_BUILD_ID%:$CODEBUILD_LOG_PATH} |
| 26 | +export CODEBUILD_BUILD_URL=https://$AWS_DEFAULT_REGION.console.aws.amazon.com/codebuild/home?region=$AWS_DEFAULT_REGION#/builds/$CODEBUILD_BUILD_ID/view/new |
| 27 | + |
| 28 | +# you can provide pip binary as s3 path in the build environment |
8 | 29 | if [ "$SMDEBUG_S3_BINARY" ]; then
|
| 30 | + cd $CODEBUILD_SRC_DIR |
| 31 | + echo "Installing smdebug and smdebug_rules from pre-generated pip wheels located at $SMDEBUG_S3_BINARY" |
9 | 32 | mkdir -p s3_pip_binary
|
10 |
| - aws s3 cp "$SMDEBUG_S3_BINARY" s3_pip_binary |
11 |
| - pip install --upgrade s3_pip_binary/*.whl |
| 33 | + aws s3 cp --recursive "$SMDEBUG_S3_BINARY" s3_pip_binary |
| 34 | + pip install --upgrade --force-reinstall s3_pip_binary/smdebug_rules-*.whl |
| 35 | + pip install --upgrade --force-reinstall s3_pip_binary/smdebug-*.whl |
| 36 | + CORE_COMMIT=`cat s3_pip_binary/CORE_COMMIT` |
| 37 | + RULES_COMMIT=`cat s3_pip_binary/RULES_COMMIT` |
| 38 | + echo "Commit hash on sagemaker-debugger-rules repository being used: $RULES_COMMIT" |
| 39 | + cd $CODEBUILD_SRC_DIR_RULES && git checkout "$RULES_COMMIT" |
| 40 | + python setup.py bdist_wheel --universal && pip install --force-reinstall dist/*.whl |
| 41 | + echo "Commit hash on sagemaker-debugger repository being used: $CORE_COMMIT" |
| 42 | + cd $CODEBUILD_SRC_DIR && git checkout "$CORE_COMMIT" |
| 43 | + python setup.py bdist_wheel --universal && pip install --force-reinstall dist/*.whl |
| 44 | + export CURRENT_DATETIME=$(date +'%Y%m%d_%H%M%S') |
| 45 | + export CURRENT_COMMIT_PATH="$CURRENT_DATETIME/$CORE_COMMIT" |
12 | 46 | else
|
13 |
| - python setup.py bdist_wheel --universal && pip install --upgrade --force-reinstall dist/*.whl |
| 47 | + ./config/change_branch.sh |
| 48 | + cd $CODEBUILD_SRC_DIR_RULES && python setup.py bdist_wheel --universal && pip install --force-reinstall dist/*.whl |
| 49 | + cd $CODEBUILD_SRC_DIR && python setup.py bdist_wheel --universal && pip install --force-reinstall dist/*.whl |
14 | 50 | fi
|
15 | 51 |
|
16 |
| - |
17 | 52 | if [ "$run_pytest_mxnet" == 'enable' ]; then
|
18 | 53 | ./config/check_smdebug_install.sh mxnet
|
19 | 54 | fi
|
|
0 commit comments