2626
2727DATA_PATH = os .path .join (DATA_DIR , 'iris' , 'data' )
2828LOCK_PATH = os .path .join (DATA_DIR , 'local_mode_lock' )
29+ DEFAULT_REGION = 'us-west-2'
2930
3031
3132class LocalNoS3Session (LocalSession ):
@@ -40,10 +41,10 @@ def __init__(self):
4041 'local_code' : True
4142 }
4243 }
43- self ._region_name = 'us-west-2'
44+ self ._region_name = DEFAULT_REGION
4445
4546
46- def test_tf_local_mode (tf_full_version ):
47+ def test_tf_local_mode (tf_full_version , sagemaker_local_session ):
4748 local_mode_lock_fd = open (LOCK_PATH , 'w' )
4849 local_mode_lock = local_mode_lock_fd .fileno ()
4950 with timeout (minutes = 5 ):
@@ -57,7 +58,8 @@ def test_tf_local_mode(tf_full_version):
5758 hyperparameters = {'input_tensor_name' : 'inputs' },
5859 train_instance_count = 1 ,
5960 train_instance_type = 'local' ,
60- base_job_name = 'test-tf' )
61+ base_job_name = 'test-tf' ,
62+ sagemaker_session = sagemaker_local_session )
6163
6264 inputs = estimator .sagemaker_session .upload_data (path = DATA_PATH ,
6365 key_prefix = 'integ-test-data/tf_iris' )
@@ -86,7 +88,7 @@ def test_tf_local_mode(tf_full_version):
8688 fcntl .lockf (local_mode_lock , fcntl .LOCK_UN )
8789
8890
89- def test_tf_distributed_local_mode ():
91+ def test_tf_distributed_local_mode (sagemaker_local_session ):
9092 local_mode_lock_fd = open (LOCK_PATH , 'w' )
9193 local_mode_lock = local_mode_lock_fd .fileno ()
9294 with timeout (minutes = 5 ):
@@ -99,7 +101,8 @@ def test_tf_distributed_local_mode():
99101 hyperparameters = {'input_tensor_name' : 'inputs' },
100102 train_instance_count = 3 ,
101103 train_instance_type = 'local' ,
102- base_job_name = 'test-tf' )
104+ base_job_name = 'test-tf' ,
105+ sagemaker_session = sagemaker_local_session )
103106
104107 inputs = 'file://' + DATA_PATH
105108 estimator .fit (inputs )
@@ -128,7 +131,7 @@ def test_tf_distributed_local_mode():
128131 fcntl .lockf (local_mode_lock , fcntl .LOCK_UN )
129132
130133
131- def test_tf_local_data ():
134+ def test_tf_local_data (sagemaker_local_session ):
132135 local_mode_lock_fd = open (LOCK_PATH , 'w' )
133136 local_mode_lock = local_mode_lock_fd .fileno ()
134137 with timeout (minutes = 5 ):
@@ -141,7 +144,8 @@ def test_tf_local_data():
141144 hyperparameters = {'input_tensor_name' : 'inputs' },
142145 train_instance_count = 1 ,
143146 train_instance_type = 'local' ,
144- base_job_name = 'test-tf' )
147+ base_job_name = 'test-tf' ,
148+ sagemaker_session = sagemaker_local_session )
145149
146150 inputs = 'file://' + DATA_PATH
147151 estimator .fit (inputs )
@@ -169,7 +173,6 @@ def test_tf_local_data():
169173 fcntl .lockf (local_mode_lock , fcntl .LOCK_UN )
170174
171175
172- @pytest .mark .skip (reason = 'Latest images not released yet' )
173176def test_tf_local_data_local_script ():
174177 local_mode_lock_fd = open (LOCK_PATH , 'w' )
175178 local_mode_lock = local_mode_lock_fd .fileno ()
@@ -214,15 +217,16 @@ def test_tf_local_data_local_script():
214217 fcntl .lockf (local_mode_lock , fcntl .LOCK_UN )
215218
216219
217- def test_mxnet_local_mode ():
220+ def test_mxnet_local_mode (sagemaker_local_session ):
218221 local_mode_lock_fd = open (LOCK_PATH , 'w' )
219222 local_mode_lock = local_mode_lock_fd .fileno ()
220223
221224 script_path = os .path .join (DATA_DIR , 'mxnet_mnist' , 'mnist.py' )
222225 data_path = os .path .join (DATA_DIR , 'mxnet_mnist' )
223226
224227 mx = MXNet (entry_point = script_path , role = 'SageMakerRole' ,
225- train_instance_count = 1 , train_instance_type = 'local' )
228+ train_instance_count = 1 , train_instance_type = 'local' ,
229+ sagemaker_session = sagemaker_local_session )
226230
227231 train_input = mx .sagemaker_session .upload_data (path = os .path .join (data_path , 'train' ),
228232 key_prefix = 'integ-test-data/mxnet_mnist/train' )
0 commit comments