Skip to content

Commit 9030bff

Browse files
committed
PR comments + adding an EIA test.
1 parent 26f6339 commit 9030bff

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

buildspec-toolkit.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ version: 0.2
33
env:
44
variables:
55
FRAMEWORK_VERSION: '1.4.0'
6+
EIA_FRAMEWORK_VERSION: '1.3.1'
67
CPU_INSTANCE_TYPE: 'ml.c4.xlarge'
78
GPU_INSTANCE_TYPE: 'ml.p2.xlarge'
9+
EIA_ACCELERATOR_TYPE: 'ml.eia2.medium'
810
ECR_REPO: 'sagemaker-test'
911
GITHUB_REPO: 'sagemaker-pytorch-serving-container'
1012
DLC_ACCOUNT: '763104351884'
@@ -39,6 +41,7 @@ phases:
3941
- GENERIC_TAG="$FRAMEWORK_VERSION-pytorch-$BUILD_ID"
4042
- DLC_CPU_TAG="$FRAMEWORK_VERSION-dlc-cpu-$BUILD_ID"
4143
- DLC_GPU_TAG="$FRAMEWORK_VERSION-dlc-gpu-$BUILD_ID"
44+
- DLC_EIA_TAG="$FRAMEWORK_VERSION-dlc-eia-$BUILD_ID"
4245

4346
# run local CPU integration tests (build and push the image to ECR repo)
4447
- test_cmd="pytest test-toolkit/integration/local --build-image --push-image --dockerfile-type pytorch --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --processor cpu --tag $GENERIC_TAG"
@@ -57,6 +60,8 @@ phases:
5760
- build_dir="test-toolkit/docker/$FRAMEWORK_VERSION"
5861
- $(aws ecr get-login --registry-ids $DLC_ACCOUNT --no-include-email --region $AWS_DEFAULT_REGION)
5962
- docker build -f "$build_dir/Dockerfile.dlc.gpu" -t $PREPROD_IMAGE:$DLC_GPU_TAG --build-arg region=$AWS_DEFAULT_REGION .
63+
- eia_build_dir="test-toolkit/docker/$EIA_FRAMEWORK_VERSION"
64+
- docker build -f "$build_dir/Dockerfile.dlc.eia" -t $PREPROD_IMAGE:$DLC_EIA_TAG --build-arg region=$AWS_DEFAULT_REGION .
6065
# push DLC GPU image to ECR
6166
- $(aws ecr get-login --registry-ids $ACCOUNT --no-include-email --region $AWS_DEFAULT_REGION)
6267
- docker push $PREPROD_IMAGE:$DLC_GPU_TAG
@@ -82,6 +87,11 @@ phases:
8287
- execute-command-if-has-matching-changes "$test_cmd" "test-toolkit/" "src/*.py" "setup.py" "setup.cfg" "buildspec-toolkit.yml" "docker/build_artifacts/*"
8388
- test_cmd="pytest test-toolkit/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --processor gpu --instance-type $GPU_INSTANCE_TYPE --tag $DLC_GPU_TAG"
8489
- execute-command-if-has-matching-changes "$test_cmd" "test-toolkit/" "src/*.py" "setup.py" "setup.cfg" "buildspec-toolkit.yml" "docker/build_artifacts/*"
90+
91+
# run EIA sagemaker integration tests
92+
- test_cmd="pytest test-toolkit/integration/sagemaker --build-image --push-image --dockerfile-type dlc.eia --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $EIA_FRAMEWORK_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --accelerator-type $EIA_ACCELERATOR_TYPE --tag $DLC_EIA_TAG"
93+
- execute-command-if-has-matching-changes "$test_cmd" "test-toolkit/" "src/*.py" "setup.py" "setup.cfg" "buildspec-toolkit.yml" "docker/build_artifacts/*"
94+
8595
finally:
8696
# shut down remote GPU instance
8797
- cleanup-gpu-instances
@@ -91,3 +101,4 @@ phases:
91101
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$GENERIC_TAG
92102
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$DLC_CPU_TAG
93103
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$DLC_GPU_TAG
104+
- aws ecr batch-delete-image --repository-name $ECR_REPO --region $AWS_DEFAULT_REGION --image-ids imageTag=$DLC_EIA_TAG

test-toolkit/conftest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -45,16 +45,17 @@
4545
def pytest_addoption(parser):
4646
parser.addoption('--build-image', '-B', action='store_true')
4747
parser.addoption('--push-image', '-P', action='store_true')
48-
parser.addoption('--dockerfile-type', '-T', choices=['dlc.cpu', 'dlc.gpu', 'pytorch'],
48+
parser.addoption('--dockerfile-type', '-T',
49+
choices=['dlc.cpu', 'dlc.gpu', 'dlc.eia', 'pytorch'],
4950
default='pytorch')
5051
parser.addoption('--dockerfile', '-D', default=None)
5152
parser.addoption('--aws-id', default=None)
5253
parser.addoption('--instance-type')
5354
parser.addoption('--accelerator-type')
54-
parser.addoption('--docker-base-name', default='sagemaker-pytorch-training')
55+
parser.addoption('--docker-base-name', default='sagemaker-pytorch-inference')
5556
parser.addoption('--region', default='us-west-2')
5657
parser.addoption('--framework-version', default="1.4.0")
57-
parser.addoption('--py-version', choices=['2', '3'], default=str(sys.version_info.major))
58+
parser.addoption('--py-version', choices=['2', '3'], default='3')
5859
# Processor is still "cpu" for EIA tests
5960
parser.addoption('--processor', choices=['gpu', 'cpu'], default='cpu')
6061
# If not specified, will default to {framework-version}-{processor}-py{py-version}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ARG region
2+
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference-eia:1.3.1-cpu-py3
3+
4+
COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
5+
RUN pip install --upgrade --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \
6+
rm /sagemaker_pytorch_inference.tar.gz

test-toolkit/docker/1.4.0/Dockerfile.dlc.cpu

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
ARG region
2-
from 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.4.0-cpu-py3
3-
4-
COPY docker/build_artifacts/changehostname.c /
5-
COPY docker/build_artifacts/start_with_right_hostname.sh /usr/local/bin/start_with_right_hostname.sh
6-
RUN chmod +x /usr/local/bin/start_with_right_hostname.sh
2+
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.4.0-cpu-py3
73

84
COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
95
RUN pip install --upgrade --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \

test-toolkit/docker/1.4.0/Dockerfile.dlc.gpu

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
ARG region
2-
from 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.4.0-gpu-py3
3-
4-
COPY docker/build_artifacts/changehostname.c /
5-
COPY docker/build_artifacts/start_with_right_hostname.sh /usr/local/bin/start_with_right_hostname.sh
6-
RUN chmod +x /usr/local/bin/start_with_right_hostname.sh
2+
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.4.0-gpu-py3
73

84
COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
95
RUN pip install --upgrade --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \

test-toolkit/docker/1.4.0/Dockerfile.pytorch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime
1+
FROM pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime
22

33
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
44
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true

test-toolkit/utils/image_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of

0 commit comments

Comments
 (0)