Skip to content

Commit ce37dfe

Browse files
iquinteroPiali Das
authored andcommitted
Improve local mode transformer test (aws#430)
Add a lock for the transformer test, similar to the serving tests as the serving container will still run on the same port. Also remove this test from the continuous testing suite.
1 parent e35ae3d commit ce37dfe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/integ/test_local_mode.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ def test_mxnet_local_data_local_script():
368368
fcntl.lockf(local_mode_lock, fcntl.LOCK_UN)
369369

370370

371-
@pytest.mark.continuous_testing
372371
def test_local_transform_mxnet(sagemaker_local_session, tmpdir):
372+
local_mode_lock_fd = open(LOCK_PATH, 'w')
373+
local_mode_lock = local_mode_lock_fd.fileno()
373374
data_path = os.path.join(DATA_DIR, 'mxnet_mnist')
374375
script_path = os.path.join(data_path, 'mnist.py')
375376

@@ -392,7 +393,13 @@ def test_local_transform_mxnet(sagemaker_local_session, tmpdir):
392393
output_path = 'file://%s' % (str(tmpdir))
393394
transformer = mx.transformer(1, 'local', assemble_with='Line', max_payload=1,
394395
strategy='SingleRecord', output_path=output_path)
396+
397+
# Since Local Mode uses the same port for serving, we need a lock in order
398+
# to allow concurrent test execution.
399+
fcntl.lockf(local_mode_lock, fcntl.LOCK_EX)
395400
transformer.transform(transform_input, content_type='text/csv', split_type='Line')
396401
transformer.wait()
402+
time.sleep(5)
403+
fcntl.lockf(local_mode_lock, fcntl.LOCK_UN)
397404

398405
assert os.path.exists(os.path.join(str(tmpdir), 'data.csv.out'))

0 commit comments

Comments
 (0)