Skip to content

Commit 3ef331f

Browse files
authored
Merge pull request #2 from ddavydenko/revert-1-master
Revert "update: Update buildspec for TF 1.15.0 (aws#265)"
2 parents 02e64b2 + 1938a6d commit 3ef331f

File tree

7 files changed

+44
-60
lines changed

7 files changed

+44
-60
lines changed

buildspec-release.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 0.2
22

33
env:
44
variables:
5-
FRAMEWORK_VERSION: '1.15.0'
5+
FRAMEWORK_VERSION: '1.13.1'
66
GPU_INSTANCE_TYPE: 'ml.p2.xlarge'
77
SETUP_FILE: 'setup_cmds.sh'
88
SETUP_CMDS: '#!/bin/bash\npip install --upgrade pip\npip install -U -e .\npip install -U -e .[test]'
@@ -60,21 +60,21 @@ phases:
6060
echo '[{
6161
"repository": "sagemaker-tensorflow-scriptmode",
6262
"tags": [{
63-
"source": "1.15.0-cpu-py2",
64-
"dest": ["1.15.0-cpu-py2", "1.15-cpu-py2", "1.15.0-cpu-py2-'${CODEBUILD_BUILD_ID#*:}'"]
63+
"source": "1.13.1-cpu-py2",
64+
"dest": ["1.13.1-cpu-py2", "1.13-cpu-py2", "1.13.1-cpu-py2-'${CODEBUILD_BUILD_ID#*:}'"]
6565
},{
66-
"source": "1.15.0-cpu-py3",
67-
"dest": ["1.15.0-cpu-py3", "1.15-cpu-py3", "1.15.0-cpu-py3-'${CODEBUILD_BUILD_ID#*:}'"]
66+
"source": "1.13.1-cpu-py3",
67+
"dest": ["1.13.1-cpu-py3", "1.13-cpu-py3", "1.13.1-cpu-py3-'${CODEBUILD_BUILD_ID#*:}'"]
6868
},{
69-
"source": "1.15.0-gpu-py2",
70-
"dest": ["1.15.0-gpu-py2", "1.15-gpu-py2", "1.15.0-gpu-py2-'${CODEBUILD_BUILD_ID#*:}'"]
69+
"source": "1.13.1-gpu-py2",
70+
"dest": ["1.13.1-gpu-py2", "1.13-gpu-py2", "1.13.1-gpu-py2-'${CODEBUILD_BUILD_ID#*:}'"]
7171
},{
72-
"source": "1.15.0-gpu-py3",
73-
"dest": ["1.15.0-gpu-py3", "1.15-gpu-py3", "1.15.0-gpu-py3-'${CODEBUILD_BUILD_ID#*:}'"]
72+
"source": "1.13.1-gpu-py3",
73+
"dest": ["1.13.1-gpu-py3", "1.13-gpu-py3", "1.13.1-gpu-py3-'${CODEBUILD_BUILD_ID#*:}'"]
7474
}],
7575
"test": [
76-
"IGNORE_COVERAGE=- tox -e py36 -- -m deploy_test test/integration/sagemaker -n 4 --region {region} --account-id {aws-id} --instance-type {cpu-instance-type} --docker-base-name sagemaker-tensorflow-scriptmode --framework-version 1.15.0 --processor cpu --py-version 2,3",
77-
"IGNORE_COVERAGE=- tox -e py36 -- -m deploy_test test/integration/sagemaker -n 4 --region {region} --account-id {aws-id} --docker-base-name sagemaker-tensorflow-scriptmode --framework-version 1.15.0 --processor gpu --py-version 2,3"
76+
"IGNORE_COVERAGE=- tox -e py36 -- -m deploy_test test/integration/sagemaker -n 4 --region {region} --account-id {aws-id} --instance-type {cpu-instance-type} --docker-base-name sagemaker-tensorflow-scriptmode --framework-version 1.13.1 --processor cpu --py-version 2,3",
77+
"IGNORE_COVERAGE=- tox -e py36 -- -m deploy_test test/integration/sagemaker -n 4 --region {region} --account-id {aws-id} --docker-base-name sagemaker-tensorflow-scriptmode --framework-version 1.13.1 --processor gpu --py-version 2,3"
7878
]
7979
}]' > deployments.json
8080

buildspec.yml

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ version: 0.2
22

33
env:
44
variables:
5-
FRAMEWORK_VERSION: '1.15.0'
5+
FRAMEWORK_VERSION: '1.13.1'
6+
CPU_FRAMEWORK_BINARY: 'https://s3-us-west-2.amazonaws.com/tensorflow-aws/1.13/AmazonLinux/cpu/latest-patch-latest-patch/tensorflow-1.13.1-cp36-cp36m-linux_x86_64.whl'
7+
CPU_PY_VERSION: '3'
8+
GPU_FRAMEWORK_BINARY: 'https://s3-us-west-2.amazonaws.com/tensorflow-aws/1.13/AmazonLinux/gpu/latest-patch-latest-patch/tensorflow-1.13.1-cp36-cp36m-linux_x86_64.whl'
9+
GPU_PY_VERSION: '3'
610
ECR_REPO: 'sagemaker-test'
711
GITHUB_REPO: 'sagemaker-tensorflow-container'
812
SETUP_FILE: 'setup_cmds.sh'
@@ -30,56 +34,42 @@ phases:
3034
- tox -e py36,py27 test/unit
3135

3236
# Create pip archive
33-
- root_dir=$(pwd)
37+
- build_dir="docker/$FRAMEWORK_VERSION"
3438
- build_id="$(echo $CODEBUILD_BUILD_ID | sed -e 's/:/-/g')"
3539
- python3 setup.py sdist
3640
- tar_name=$(ls dist)
37-
38-
# Find build artifacts
39-
- build_artifacts=$root_dir/docker/artifacts
40-
41-
# build py2 images
42-
43-
# prepare build context
44-
- build_dir="$root_dir/docker/$FRAMEWORK_VERSION/py2"
45-
- cp $root_dir/dist/$tar_name $build_dir
46-
- cp $build_artifacts/* $build_dir/
47-
- cd $build_dir
41+
- cp dist/$tar_name $build_dir
4842

4943
# build cpu image
5044
- cpu_dockerfile="Dockerfile.cpu"
51-
- CPU_TAG_PY2="$FRAMEWORK_VERSION-cpu-py2-$build_id"
52-
- docker build -f $cpu_dockerfile -t $PREPROD_IMAGE:$CPU_TAG_PY2 .
5345

54-
# build gpu image
55-
- gpu_dockerfile="Dockerfile.gpu"
56-
- GPU_TAG_PY2="$FRAMEWORK_VERSION-gpu-py2-$build_id"
57-
- docker build -f $gpu_dockerfile -t $PREPROD_IMAGE:$GPU_TAG_PY2 .
46+
# Download framework binary
47+
- cpu_fw_binary=$(basename $CPU_FRAMEWORK_BINARY)
48+
- wget -O $build_dir/$cpu_fw_binary $CPU_FRAMEWORK_BINARY
5849

59-
# build py3 images
50+
- CPU_TAG="$FRAMEWORK_VERSION-cpu-py$CPU_PY_VERSION-$build_id"
6051

61-
# prepare build context
62-
- build_dir="$root_dir/docker/$FRAMEWORK_VERSION/py3"
63-
- cp $root_dir/dist/$tar_name $build_dir
64-
- cp $build_artifacts/* $build_dir/
6552
- cd $build_dir
66-
67-
# build cpu image
68-
- cpu_dockerfile="Dockerfile.cpu"
69-
- CPU_TAG_PY3="$FRAMEWORK_VERSION-cpu-py3-$build_id"
70-
- docker build -f $cpu_dockerfile -t $PREPROD_IMAGE:$CPU_TAG_PY3 .
53+
- docker build -f $cpu_dockerfile --build-arg framework_support_installable=$tar_name --build-arg py_version=$CPU_PY_VERSION --build-arg framework_installable=$cpu_fw_binary -t $PREPROD_IMAGE:$CPU_TAG .
54+
- cd ../../
7155

7256
# build gpu image
7357
- gpu_dockerfile="Dockerfile.gpu"
74-
- GPU_TAG_PY3="$FRAMEWORK_VERSION-gpu-py3-$build_id"
75-
- docker build -f $gpu_dockerfile -t $PREPROD_IMAGE:$GPU_TAG_PY3 .
58+
59+
# Download framework binary
60+
- gpu_fw_binary=$(basename $GPU_FRAMEWORK_BINARY)
61+
- wget -O $build_dir/$gpu_fw_binary $GPU_FRAMEWORK_BINARY
62+
63+
- GPU_TAG="$FRAMEWORK_VERSION-gpu-py$GPU_PY_VERSION-$build_id"
64+
65+
- cd $build_dir
66+
- docker build -f $gpu_dockerfile --build-arg framework_support_installable=$tar_name --build-arg py_version=$GPU_PY_VERSION --build-arg framework_installable=$gpu_fw_binary -t $PREPROD_IMAGE:$GPU_TAG .
67+
- cd ../../
7668

7769
# push images to ecr
7870
- $(aws ecr get-login --registry-ids $ACCOUNT --no-include-email --region $AWS_DEFAULT_REGION)
79-
- docker push $PREPROD_IMAGE:$CPU_TAG_PY2
80-
- docker push $PREPROD_IMAGE:$GPU_TAG_PY2
81-
- docker push $PREPROD_IMAGE:$CPU_TAG_PY3
82-
- docker push $PREPROD_IMAGE:$GPU_TAG_PY3
71+
- docker push $PREPROD_IMAGE:$CPU_TAG
72+
- docker push $PREPROD_IMAGE:$GPU_TAG
8373

8474
# launch remote gpu instance
8575
- instance_type='p2.xlarge'
@@ -89,8 +79,7 @@ phases:
8979
# run cpu integration tests
9080
- |
9181
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
92-
pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --tag $CPU_TAG_PY2 --framework-version $FRAMEWORK_VERSION --py-version 2 --processor cpu
93-
pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --tag $CPU_TAG_PY3 --framework-version $FRAMEWORK_VERSION --py-version 3 --processor cpu
82+
pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --tag $CPU_TAG --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY_VERSION --processor cpu
9483
else
9584
echo "skipping cpu integration tests"
9685
fi
@@ -99,9 +88,7 @@ phases:
9988
- |
10089
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
10190
printf "$SETUP_CMDS" > $SETUP_FILE
102-
cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --tag $GPU_TAG_PY2 --framework-version $FRAMEWORK_VERSION --py-version 2 --processor gpu"
103-
remote-test --github-repo $GITHUB_REPO --test-cmd "$cmd" --setup-file $SETUP_FILE --pr-number "$PR_NUM"
104-
cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --tag $GPU_TAG_PY3 --framework-version $FRAMEWORK_VERSION --py-version 3 --processor gpu"
91+
cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --tag $GPU_TAG --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY_VERSION --processor gpu"
10592
remote-test --github-repo $GITHUB_REPO --test-cmd "$cmd" --setup-file $SETUP_FILE --pr-number "$PR_NUM"
10693
else
10794
echo "skipping gpu integration tests"
@@ -110,10 +97,8 @@ phases:
11097
# run sagemaker tests
11198
- |
11299
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
113-
pytest test/integration/sagemaker -n 8 --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --account-id $ACCOUNT --tag $CPU_TAG_PY2 --py-version 2 --processor cpu
114-
pytest test/integration/sagemaker -n 8 --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --account-id $ACCOUNT --tag $GPU_TAG_PY2 --py-version 2 --processor gpu
115-
pytest test/integration/sagemaker -n 8 --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --account-id $ACCOUNT --tag $CPU_TAG_PY3 --py-version 3 --processor cpu
116-
pytest test/integration/sagemaker -n 8 --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --account-id $ACCOUNT --tag $GPU_TAG_PY3 --py-version 3 --processor gpu
100+
pytest test/integration/sagemaker -n 8 --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --account-id $ACCOUNT --tag $CPU_TAG --py-version $CPU_PY_VERSION --processor cpu
101+
pytest test/integration/sagemaker -n 8 --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --account-id $ACCOUNT --tag $GPU_TAG --py-version $GPU_PY_VERSION --processor gpu
117102
else
118103
echo "skipping sagemaker tests"
119104
fi
@@ -124,7 +109,5 @@ phases:
124109
- cleanup-key-pairs
125110

126111
# remove ecr image
127-
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$CPU_TAG_PY2
128-
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$GPU_TAG_PY2
129-
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$CPU_TAG_PY3
130-
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$GPU_TAG_PY3
112+
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$CPU_TAG
113+
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$GPU_TAG

docker/__init__.py

Whitespace-only changes.

docker/build_artifacts/__init__.py

Whitespace-only changes.

test/unit/test_deep_learning_container.py renamed to test/unit/test_deep_learning_containers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
import unittest
1616

17-
from docker.build_artifacts import deep_learning_container as deep_learning_container_to_test
1817
import pytest
1918
import requests
2019

20+
from sagemaker_tensorflow_container import deep_learning_container as deep_learning_container_to_test
21+
2122

2223
@pytest.fixture(name='fixture_valid_instance_id')
2324
def fixture_valid_instance_id(requests_mock):

0 commit comments

Comments
 (0)