@@ -2,7 +2,11 @@ version: 0.2
2
2
3
3
env :
4
4
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'
6
10
ECR_REPO : ' sagemaker-test'
7
11
GITHUB_REPO : ' sagemaker-tensorflow-container'
8
12
SETUP_FILE : ' setup_cmds.sh'
@@ -30,56 +34,42 @@ phases:
30
34
- tox -e py36,py27 test/unit
31
35
32
36
# Create pip archive
33
- - root_dir=$(pwd)
37
+ - build_dir="docker/$FRAMEWORK_VERSION"
34
38
- build_id="$(echo $CODEBUILD_BUILD_ID | sed -e 's/:/-/g')"
35
39
- python3 setup.py sdist
36
40
- 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
48
42
49
43
# build cpu image
50
44
- 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 .
53
45
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
58
49
59
- # build py3 images
50
+ - CPU_TAG="$FRAMEWORK_VERSION-cpu-py$CPU_PY_VERSION-$build_id"
60
51
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/
65
52
- 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 ../../
71
55
72
56
# build gpu image
73
57
- 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 ../../
76
68
77
69
# push images to ecr
78
70
- $(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
83
73
84
74
# launch remote gpu instance
85
75
- instance_type='p2.xlarge'
@@ -89,8 +79,7 @@ phases:
89
79
# run cpu integration tests
90
80
- |
91
81
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
94
83
else
95
84
echo "skipping cpu integration tests"
96
85
fi
@@ -99,9 +88,7 @@ phases:
99
88
- |
100
89
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
101
90
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"
105
92
remote-test --github-repo $GITHUB_REPO --test-cmd "$cmd" --setup-file $SETUP_FILE --pr-number "$PR_NUM"
106
93
else
107
94
echo "skipping gpu integration tests"
@@ -110,10 +97,8 @@ phases:
110
97
# run sagemaker tests
111
98
- |
112
99
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
117
102
else
118
103
echo "skipping sagemaker tests"
119
104
fi
@@ -124,7 +109,5 @@ phases:
124
109
- cleanup-key-pairs
125
110
126
111
# 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
0 commit comments