From ac88fa0820faad6bfe443d84e60e67327e8d129f Mon Sep 17 00:00:00 2001 From: Deng Date: Mon, 9 Mar 2020 10:14:38 -0700 Subject: [PATCH 1/2] fix: skip pytorch ei test in unsupported regions --- tests/integ/test_pytorch_train.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/integ/test_pytorch_train.py b/tests/integ/test_pytorch_train.py index c1164e13e7..82cb94fb47 100644 --- a/tests/integ/test_pytorch_train.py +++ b/tests/integ/test_pytorch_train.py @@ -120,6 +120,10 @@ def test_deploy_model(pytorch_training_job, sagemaker_session, cpu_instance_type @pytest.mark.skipif(PYTHON_VERSION == "py2", reason="PyTorch EIA does not support Python 2.") +@pytest.mark.skipif( + tests.integ.test_region() not in tests.integ.EI_SUPPORTED_REGIONS, + reason="EI isn't supported in that specific region.", +) def test_deploy_model_with_accelerator(sagemaker_session, cpu_instance_type): endpoint_name = "test-pytorch-deploy-eia-{}".format(sagemaker_timestamp()) model_data = sagemaker_session.upload_data(path=EIA_MODEL) @@ -134,7 +138,7 @@ def test_deploy_model_with_accelerator(sagemaker_session, cpu_instance_type): predictor = pytorch.deploy( initial_instance_count=1, instance_type=cpu_instance_type, - accelerator_type="ml.eia2.medium", + accelerator_type="ml.eia1.medium", endpoint_name=endpoint_name, ) From d81afe88be8827bceeb5ab7593db9b68689934ac Mon Sep 17 00:00:00 2001 From: Deng Date: Mon, 9 Mar 2020 10:36:46 -0700 Subject: [PATCH 2/2] fix flake8 error --- tests/integ/test_pytorch_train.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/integ/test_pytorch_train.py b/tests/integ/test_pytorch_train.py index 82cb94fb47..4066d5001b 100644 --- a/tests/integ/test_pytorch_train.py +++ b/tests/integ/test_pytorch_train.py @@ -12,18 +12,23 @@ # language governing permissions and limitations under the License. from __future__ import absolute_import -import os - import numpy +import os import pytest -from tests.integ import DATA_DIR, PYTHON_VERSION, TRAINING_DEFAULT_TIMEOUT_MINUTES -from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name - +from sagemaker.pytorch.defaults import LATEST_PY2_VERSION from sagemaker.pytorch.estimator import PyTorch from sagemaker.pytorch.model import PyTorchModel -from sagemaker.pytorch.defaults import LATEST_PY2_VERSION from sagemaker.utils import sagemaker_timestamp +from tests.integ import ( + test_region, + DATA_DIR, + PYTHON_VERSION, + TRAINING_DEFAULT_TIMEOUT_MINUTES, + EI_SUPPORTED_REGIONS, +) +from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name + MNIST_DIR = os.path.join(DATA_DIR, "pytorch_mnist") MNIST_SCRIPT = os.path.join(MNIST_DIR, "mnist.py") @@ -121,8 +126,7 @@ def test_deploy_model(pytorch_training_job, sagemaker_session, cpu_instance_type @pytest.mark.skipif(PYTHON_VERSION == "py2", reason="PyTorch EIA does not support Python 2.") @pytest.mark.skipif( - tests.integ.test_region() not in tests.integ.EI_SUPPORTED_REGIONS, - reason="EI isn't supported in that specific region.", + test_region() not in EI_SUPPORTED_REGIONS, reason="EI isn't supported in that specific region." ) def test_deploy_model_with_accelerator(sagemaker_session, cpu_instance_type): endpoint_name = "test-pytorch-deploy-eia-{}".format(sagemaker_timestamp())