@@ -286,17 +286,20 @@ def test_run_tensorboard_locally_without_awscli_binary(time, strftime, popen, ca
286
286
'following command: \n pip install awscli'
287
287
288
288
289
+ @patch ('sagemaker.tensorflow.estimator.Tensorboard._sync_directories' )
289
290
@patch ('tempfile.mkdtemp' , return_value = '/my/temp/folder' )
291
+ @patch ('shutil.rmtree' )
290
292
@patch ('os.access' , return_value = True )
291
293
@patch ('subprocess.call' )
292
294
@patch ('subprocess.Popen' )
293
295
@patch ('time.strftime' , return_value = TIMESTAMP )
294
296
@patch ('time.time' , return_value = TIME )
295
- @pytest .mark .skip (reason = "this test fails sometimes and it needs further investigation" )
296
- def test_run_tensorboard_locally (time , strftime , popen , call , access , sagemaker_session ):
297
+ def test_run_tensorboard_locally (time , strftime , popen , call , access , rmtree , mkdtemp , sync , sagemaker_session ):
297
298
tf = TensorFlow (entry_point = SCRIPT_PATH , role = ROLE , sagemaker_session = sagemaker_session ,
298
299
train_instance_count = INSTANCE_COUNT , train_instance_type = INSTANCE_TYPE )
299
300
301
+ popen ().poll .return_value = None
302
+
300
303
tf .fit (inputs = 's3://mybucket/train' , run_tensorboard_locally = True )
301
304
302
305
popen .assert_called_with (['tensorboard' , '--logdir' , '/my/temp/folder' , '--host' , 'localhost' , '--port' , '6006' ],
@@ -305,19 +308,21 @@ def test_run_tensorboard_locally(time, strftime, popen, call, access, sagemaker_
305
308
)
306
309
307
310
311
+ @patch ('sagemaker.tensorflow.estimator.Tensorboard._sync_directories' )
308
312
@patch ('tempfile.mkdtemp' , return_value = '/my/temp/folder' )
313
+ @patch ('shutil.rmtree' )
309
314
@patch ('socket.socket' )
310
315
@patch ('os.access' , return_value = True )
311
316
@patch ('subprocess.call' )
312
317
@patch ('subprocess.Popen' )
313
318
@patch ('time.strftime' , return_value = TIMESTAMP )
314
319
@patch ('time.time' , return_value = TIME )
315
- @ pytest . mark . skip ( reason = "this test fails sometimes and it needs further investigation" )
316
- def test_run_tensorboard_locally_port_in_use ( time , strftime , popen , call , access , socket , sagemaker_session ):
320
+ def test_run_tensorboard_locally_port_in_use ( time , strftime , popen , call , access , socket , rmtree , mkdtemp , sync ,
321
+ sagemaker_session ):
317
322
tf = TensorFlow (entry_point = SCRIPT_PATH , role = ROLE , sagemaker_session = sagemaker_session ,
318
323
train_instance_count = INSTANCE_COUNT , train_instance_type = INSTANCE_TYPE )
319
324
320
- popen ().poll .side_effect = [True , False ]
325
+ popen ().poll .side_effect = [- 1 , None ]
321
326
322
327
tf .fit (inputs = 's3://mybucket/train' , run_tensorboard_locally = True )
323
328
0 commit comments