Skip to content

Commit 4390df7

Browse files
icywang86ruiEliza Zhang
authored andcommitted
fix: skip gpu SageMaker test in regions with limited amount of p2/3 i… (aws#199)
* fix: skip gpu SageMaker test in regions with limited amount of p2/3 instances
1 parent c220a3e commit 4390df7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from sagemaker import LocalSession, Session
2121
from sagemaker.tensorflow import TensorFlow
2222

23+
from test.integration import NO_P2_REGIONS, NO_P3_REGIONS
24+
2325
logger = logging.getLogger(__name__)
2426
logging.getLogger('boto').setLevel(logging.INFO)
2527
logging.getLogger('botocore').setLevel(logging.INFO)
@@ -103,6 +105,13 @@ def skip_by_device_type(request, processor):
103105
pytest.skip('Skipping because running on \'{}\' instance'.format(processor))
104106

105107

108+
@pytest.fixture(autouse=True)
109+
def skip_gpu_instance_restricted_regions(region, instance_type):
110+
if((region in NO_P2_REGIONS and instance_type.startswith('ml.p2')) or
111+
(region in NO_P3_REGIONS and instance_type.startswith('ml.p3'))):
112+
pytest.skip('Skipping GPU test in region {}'.format(region))
113+
114+
106115
@pytest.fixture(scope='session')
107116
def docker_image(docker_base_name, tag):
108117
return '{}:{}'.format(docker_base_name, tag)

test/integration/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@
1919
logging.getLogger('botocore').setLevel(logging.INFO)
2020

2121
RESOURCE_PATH = os.path.join(os.path.dirname(__file__), '..', 'resources')
22+
23+
# these regions have some p2 and p3 instances, but not enough for automated testing
24+
NO_P2_REGIONS = ['ca-central-1', 'eu-central-1', 'eu-west-2', 'us-west-1']
25+
NO_P3_REGIONS = ['ap-southeast-1', 'ap-southeast-2', 'ap-south-1', 'ca-central-1',
26+
'eu-central-1', 'eu-west-2', 'us-west-1']

0 commit comments

Comments
 (0)