Skip to content

Commit ca4287d

Browse files
committed
address pr comments
1 parent 429b8d2 commit ca4287d

File tree

9 files changed

+22
-1
lines changed

9 files changed

+22
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ venv/
2525
*~
2626
.pytest_cache/
2727
*.swp
28-
tests/data/local_mode_lock
28+
.docker/

tests/data/local_mode_lock

Whitespace-only changes.

tests/data/mxnet_mnist/MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
recursive-include . *
3+
recursive-exclude . __pycache__*
4+
recursive-exclude . *.pyc
5+
recursive-exclude . *.pyo

tests/data/mxnet_mnist/setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
[wheel]
3+
universal = 1

tests/data/mxnet_mnist/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
from setuptools import setup
3+
setup(packages=[''],
4+
name="mnist",
5+
version='1.0.0',
6+
include_package_data=True)

tests/integ/lock.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
@contextmanager
2525
def lock(path=DEFAULT_LOCK_PATH):
26+
"""Create a file lock to control concurrent test execution. Certain tests or
27+
test operations need to limit concurrency to work reliably. Examples include
28+
local mode endpoint tests and vpc creation tests.
29+
"""
2630
f = open(path, 'w')
2731
fd = f.fileno()
2832

tests/integ/test_local_mode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from sagemaker.mxnet import MXNet
2929
from sagemaker.tensorflow import TensorFlow
3030

31+
# endpoint tests all use the same port, so we use this lock to prevent concurrent execution
3132
LOCK_PATH = os.path.join(tempfile.gettempdir(), 'sagemaker_test_local_mode_lock')
3233
DATA_PATH = os.path.join(DATA_DIR, 'iris', 'data')
3334
DEFAULT_REGION = 'us-west-2'

tests/integ/test_source_dirs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def test_source_dirs(tmpdir, sagemaker_local_session):
3737
sagemaker_session=sagemaker_local_session)
3838
estimator.fit()
3939

40+
# endpoint tests all use the same port, so we use this lock to prevent concurrent execution
4041
with lock.lock():
4142
try:
4243
predictor = estimator.deploy(initial_instance_count=1, instance_type='local')

tests/integ/vpc_test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def _create_vpc_with_name(ec2_client, region, name):
9393

9494

9595
def get_or_create_vpc_resources(ec2_client, region, name=VPC_NAME):
96+
# use lock to prevent race condition when tests are running concurrently
9697
with lock.lock(LOCK_PATH):
9798
if _vpc_exists(ec2_client, name):
9899
print('using existing vpc: {}'.format(name))

0 commit comments

Comments
 (0)