Skip to content

Commit cc4900e

Browse files
authored
Update test_local_mode.py
1 parent 3005827 commit cc4900e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/integ/test_local_mode.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
import pytest
2121
import tempfile
2222

23+
import stopit
24+
2325
import tests.integ.lock as lock
2426
from tests.integ import DATA_DIR, PYTHON_VERSION
25-
from tests.integ.timeout import timeout
2627

2728
from sagemaker.local import LocalSession, LocalSagemakerRuntimeClient, LocalSagemakerClient
2829
from sagemaker.mxnet import MXNet
@@ -86,7 +87,7 @@ def _create_model(output_path):
8687
@pytest.mark.local_mode
8788
@pytest.mark.skipif(PYTHON_VERSION != "py2", reason="TensorFlow image supports only python 2.")
8889
def test_tf_local_mode(sagemaker_local_session):
89-
with timeout(minutes=5):
90+
with stopit.ThreadingTimeout(5 * 60, swallow_exc=False):
9091
script_path = os.path.join(DATA_DIR, "iris", "iris-dnn-classifier.py")
9192

9293
estimator = TensorFlow(
@@ -129,7 +130,7 @@ def test_tf_local_mode(sagemaker_local_session):
129130
@pytest.mark.local_mode
130131
@pytest.mark.skipif(PYTHON_VERSION != "py2", reason="TensorFlow image supports only python 2.")
131132
def test_tf_distributed_local_mode(sagemaker_local_session):
132-
with timeout(minutes=5):
133+
with stopit.ThreadingTimeout(5 * 60, swallow_exc=False):
133134
script_path = os.path.join(DATA_DIR, "iris", "iris-dnn-classifier.py")
134135

135136
estimator = TensorFlow(
@@ -171,7 +172,7 @@ def test_tf_distributed_local_mode(sagemaker_local_session):
171172
@pytest.mark.local_mode
172173
@pytest.mark.skipif(PYTHON_VERSION != "py2", reason="TensorFlow image supports only python 2.")
173174
def test_tf_local_data(sagemaker_local_session):
174-
with timeout(minutes=5):
175+
with stopit.ThreadingTimeout(5 * 60, swallow_exc=False):
175176
script_path = os.path.join(DATA_DIR, "iris", "iris-dnn-classifier.py")
176177

177178
estimator = TensorFlow(
@@ -212,7 +213,7 @@ def test_tf_local_data(sagemaker_local_session):
212213
@pytest.mark.local_mode
213214
@pytest.mark.skipif(PYTHON_VERSION != "py2", reason="TensorFlow image supports only python 2.")
214215
def test_tf_local_data_local_script():
215-
with timeout(minutes=5):
216+
with stopit.ThreadingTimeout(5 * 60, swallow_exc=False):
216217
script_path = os.path.join(DATA_DIR, "iris", "iris-dnn-classifier.py")
217218

218219
estimator = TensorFlow(
@@ -391,7 +392,7 @@ def test_local_transform_mxnet(sagemaker_local_session, tmpdir, mxnet_full_versi
391392
path=os.path.join(data_path, "test"), key_prefix="integ-test-data/mxnet_mnist/test"
392393
)
393394

394-
with timeout(minutes=15):
395+
with stopit.ThreadingTimeout(5 * 60, swallow_exc=False):
395396
mx.fit({"train": train_input, "test": test_input})
396397

397398
transform_input_path = os.path.join(data_path, "transform")

0 commit comments

Comments
 (0)