Skip to content

Commit 1ac8564

Browse files
committed
Merge remote-tracking branch 'aws/master' into fix-tf2-sm-benchmark
* aws/master: Skip temporarily to revert it (aws#1087) Add back efa configs to SM tests (aws#1086)
2 parents 477b91a + caa2d9b commit 1ac8564

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

test/dlc_tests/sanity/test_pre_release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _run_dependency_check_test(image, ec2_connection, processor):
272272
@pytest.mark.model("N/A")
273273
@pytest.mark.canary("Run dependency tests regularly on production images")
274274
@pytest.mark.parametrize("ec2_instance_type", ["c5.4xlarge"], indirect=True)
275-
@pytest.mark.skipif(not (is_nightly_context() or is_mainline_context() or (is_canary_context() and is_time_for_canary_safety_scan())),
275+
@pytest.mark.skipif(not (is_nightly_context() or (is_canary_context() and is_time_for_canary_safety_scan())),
276276
reason="Do not run dependency check on PR tests. "
277277
"Executing test in canaries pipeline during only a limited period of time."
278278
)
@@ -283,7 +283,7 @@ def test_dependency_check_cpu(cpu, ec2_connection):
283283
@pytest.mark.model("N/A")
284284
@pytest.mark.canary("Run dependency tests regularly on production images")
285285
@pytest.mark.parametrize("ec2_instance_type", ["p3.2xlarge"], indirect=True)
286-
@pytest.mark.skipif(not (is_nightly_context() or is_mainline_context() or (is_canary_context() and is_time_for_canary_safety_scan())),
286+
@pytest.mark.skipif(not (is_nightly_context() or (is_canary_context() and is_time_for_canary_safety_scan())),
287287
reason="Do not run dependency check on PR tests. "
288288
"Executing test in canaries pipeline during only a limited period of time."
289289
)

test/sagemaker_tests/pytorch/training/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ def pytest_addoption(parser):
105105
parser.addoption('--tag', default=None)
106106
parser.addoption('--generate-coverage-doc', default=False, action='store_true',
107107
help='use this option to generate test coverage doc')
108+
parser.addoption(
109+
"--efa", action="store_true", default=False, help="Run only efa tests",
110+
)
111+
112+
113+
def pytest_configure(config):
114+
config.addinivalue_line("markers", "efa(): explicitly mark to run efa tests")
115+
116+
117+
def pytest_runtest_setup(item):
118+
if item.config.getoption("--efa"):
119+
efa_tests = [mark for mark in item.iter_markers(name="efa")]
120+
if not efa_tests:
121+
pytest.skip("Skipping non-efa tests")
108122

109123

110124
def pytest_collection_modifyitems(session, config, items):

test/sagemaker_tests/tensorflow/tensorflow2_training/integration/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ def pytest_addoption(parser):
4242
parser.addoption('--instance-type', default=None)
4343
parser.addoption('--generate-coverage-doc', default=False, action='store_true',
4444
help='use this option to generate test coverage doc')
45+
parser.addoption(
46+
"--efa", action="store_true", default=False, help="Run only efa tests",
47+
)
48+
49+
50+
def pytest_runtest_setup(item):
51+
if item.config.getoption("--efa"):
52+
efa_tests = [mark for mark in item.iter_markers("efa")]
53+
if not efa_tests:
54+
pytest.skip("Skipping non-efa tests")
4555

4656

4757
def pytest_collection_modifyitems(session, config, items):
@@ -54,6 +64,7 @@ def pytest_collection_modifyitems(session, config, items):
5464
def pytest_configure(config):
5565
os.environ['TEST_PY_VERSIONS'] = config.getoption('--py-version')
5666
os.environ['TEST_PROCESSORS'] = config.getoption('--processor')
67+
config.addinivalue_line("markers", "efa(): explicitly mark to run efa tests")
5768

5869

5970
@pytest.fixture(scope='session')

test/test_utils/sagemaker.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ def generate_sagemaker_pytest_cmd(image, sagemaker_test_type):
140140
is_py3 = " python3 -m "
141141

142142
efa_flag = ""
143-
if job_type == "training" and (framework == "tensorflow" or framework == "pytorch"):
144-
efa_dedicated = os.getenv("EFA_DEDICATED", "False").lower() == "true"
145-
efa_flag = '--efa' if efa_dedicated else '-m not efa'
143+
if job_type == "training":
144+
if (framework == "tensorflow" and framework_major_version >= "2") or framework == "pytorch":
145+
efa_dedicated = os.getenv("EFA_DEDICATED", "False").lower() == "true"
146+
efa_flag = '--efa' if efa_dedicated else '-m \"not efa\"'
146147

147148
remote_pytest_cmd = (
148149
f"pytest -rA {integration_path} --region {region} --processor {processor} {docker_base_arg} "

0 commit comments

Comments
 (0)