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