@@ -2,10 +2,12 @@ version: 0.2
2
2
3
3
env :
4
4
variables :
5
- FRAMEWORK_VERSION : ' 1.1.0'
6
- CPU_PY_VERSION : ' 2'
5
+ FRAMEWORK_VERSION : ' 1.2.0'
6
+ CPU_PY2_VERSION : ' 2'
7
+ CPU_PY3_VERSION : ' 3'
7
8
CPU_INSTANCE_TYPE : ' ml.c4.xlarge'
8
- GPU_PY_VERSION : ' 3'
9
+ GPU_PY2_VERSION : ' 2'
10
+ GPU_PY3_VERSION : ' 3'
9
11
GPU_INSTANCE_TYPE : ' ml.p2.xlarge'
10
12
LOCAL_BASE_REPO : ' pytorch-base'
11
13
ECR_REPO : ' sagemaker-test'
@@ -33,39 +35,26 @@ phases:
33
35
# run unit tests
34
36
- pytest test/unit
35
37
36
- # build cpu base image
37
- - base_dir="docker/$FRAMEWORK_VERSION/base"
38
- - cpu_py2_base_tag="$FRAMEWORK_VERSION-cpu-py2"
39
- - cpu_py3_base_tag="$FRAMEWORK_VERSION-cpu-py3"
38
+ # create wheel in dist/
39
+ - python3 setup.py bdist_wheel
40
+ - whl_name=$(ls dist/sagemaker_pytorch_serving_container*.whl)
41
+ - cp $whl_name sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl
42
+
40
43
- cpu_dockerfile="Dockerfile.cpu"
41
- - cd $base_dir
42
- - docker build -t $LOCAL_BASE_REPO:$cpu_py2_base_tag -f $cpu_dockerfile --build-arg py_version=2 .
43
- - docker build -t $LOCAL_BASE_REPO:$cpu_py3_base_tag -f $cpu_dockerfile --build-arg py_version=3 .
44
- - cd ../../../
45
-
46
- # build gpu base image
47
- - gpu_py2_base_tag="$FRAMEWORK_VERSION-gpu-py2"
48
- - gpu_py3_base_tag="$FRAMEWORK_VERSION-gpu-py3"
49
44
- gpu_dockerfile="Dockerfile.gpu"
50
- - cd $base_dir
51
- - docker build -t $LOCAL_BASE_REPO:$gpu_py2_base_tag -f $gpu_dockerfile --build-arg py_version=2 .
52
- - docker build -t $LOCAL_BASE_REPO:$gpu_py3_base_tag -f $gpu_dockerfile --build-arg py_version=3 .
53
- - cd ../../../
54
45
55
- # create wheel
56
- - python3 setup.py bdist_wheel
57
-
58
- # build cpu image
59
- - build_dir="docker/$FRAMEWORK_VERSION/final"
46
+ # build py2 images
47
+ - build_dir="docker/$FRAMEWORK_VERSION/py$CPU_PY2_VERSION"
60
48
- CPU_PY2_TAG="$FRAMEWORK_VERSION-cpu-py2-$BUILD_ID"
61
- - CPU_PY3_TAG ="$FRAMEWORK_VERSION-cpu-py3 -$BUILD_ID"
49
+ - GPU_PY2_TAG ="$FRAMEWORK_VERSION-gpu-py2 -$BUILD_ID"
62
50
- docker build -f "$build_dir/$cpu_dockerfile" --build-arg py_version=2 -t $PREPROD_IMAGE:$CPU_PY2_TAG .
63
- - docker build -f "$build_dir/$cpu_dockerfile " --build-arg py_version=3 -t $PREPROD_IMAGE:$CPU_PY3_TAG .
51
+ - docker build -f "$build_dir/$gpu_dockerfile " --build-arg py_version=2 -t $PREPROD_IMAGE:$GPU_PY2_TAG .
64
52
65
- # build gpu image
66
- - GPU_PY2_TAG="$FRAMEWORK_VERSION-gpu-py2-$BUILD_ID"
53
+ # build py3 image
54
+ - build_dir="docker/$FRAMEWORK_VERSION/py$GPU_PY3_VERSION"
55
+ - CPU_PY3_TAG="$FRAMEWORK_VERSION-cpu-py3-$BUILD_ID"
67
56
- GPU_PY3_TAG="$FRAMEWORK_VERSION-gpu-py3-$BUILD_ID"
68
- - docker build -f "$build_dir/$gpu_dockerfile" --build-arg py_version=2 -t $PREPROD_IMAGE:$GPU_PY2_TAG .
57
+ - docker build -f "$build_dir/$gpu_dockerfile" --build-arg py_version=3 -t $PREPROD_IMAGE:$CPU_PY3_TAG .
69
58
- docker build -f "$build_dir/$gpu_dockerfile" --build-arg py_version=3 -t $PREPROD_IMAGE:$GPU_PY3_TAG .
70
59
71
60
# push images to ecr
@@ -84,8 +73,8 @@ phases:
84
73
# run cpu integration tests
85
74
- |
86
75
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
87
- pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY_VERSION --processor cpu --tag $CPU_PY3_TAG
88
- pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY_VERSION --processor cpu --tag $CPU_PY2_TAG
76
+ pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY3_VERSION --processor cpu --tag $CPU_PY3_TAG
77
+ pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY2_VERSION --processor cpu --tag $CPU_PY2_TAG
89
78
else
90
79
echo "skipping cpu integration tests"
91
80
fi
@@ -94,8 +83,8 @@ phases:
94
83
- |
95
84
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
96
85
printf "$SETUP_CMDS" > $SETUP_FILE
97
- py3_cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY_VERSION --processor gpu --tag $GPU_PY3_TAG"
98
- py3_cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY_VERSION --processor gpu --tag $GPU_PY2_TAG"
86
+ py3_cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY3_VERSION --processor gpu --tag $GPU_PY3_TAG"
87
+ py3_cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY2_VERSION --processor gpu --tag $GPU_PY2_TAG"
99
88
remote-test --github-repo $GITHUB_REPO --test-cmd "$py3_cmd" --setup-file $SETUP_FILE --pr-number "$PR_NUM"
100
89
else
101
90
echo "skipping gpu integration tests"
@@ -104,17 +93,17 @@ phases:
104
93
# run cpu sagemaker tests
105
94
- |
106
95
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
107
- pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $CPU_PY3_TAG
108
- pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $CPU_PY2_TAG
96
+ pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY3_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $CPU_PY3_TAG
97
+ pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY2_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $CPU_PY2_TAG
109
98
else
110
99
echo "skipping cpu sagemaker tests"
111
100
fi
112
101
113
102
# run gpu sagemaker tests
114
103
- |
115
104
if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then
116
- pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY_VERSION --processor gpu --instance-type $GPU_INSTANCE_TYPE --tag $GPU_PY3_TAG
117
- pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $GPU_PY2_TAG
105
+ pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY3_VERSION --processor gpu --instance-type $GPU_INSTANCE_TYPE --tag $GPU_PY3_TAG
106
+ pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY2_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $GPU_PY2_TAG
118
107
else
119
108
echo "skipping gpu sagemaker tests"
120
109
fi
0 commit comments