@@ -41,10 +41,11 @@ def test_sync_fit(sagemaker_session, pytorch_full_version, instance_type):
41
41
sagemaker_session = sagemaker_session )
42
42
43
43
pytorch .fit ({'training' : _upload_training_data (pytorch )})
44
- training_job_name = pytorch .latest_training_job .name
44
+ training_job_name = pytorch .latest_training_job .name
45
45
46
- with timeout (minutes = 20 ):
47
- PyTorch .attach (training_job_name , sagemaker_session = sagemaker_session )
46
+ if not _is_local_mode (instance_type ):
47
+ with timeout (minutes = 20 ):
48
+ PyTorch .attach (training_job_name , sagemaker_session = sagemaker_session )
48
49
49
50
50
51
def test_async_fit (sagemaker_session , pytorch_full_version , instance_type ):
@@ -61,9 +62,10 @@ def test_async_fit(sagemaker_session, pytorch_full_version, instance_type):
61
62
print ("Waiting to re-attach to the training job: %s" % training_job_name )
62
63
time .sleep (20 )
63
64
64
- with timeout (minutes = 35 ):
65
- print ("Re-attaching now to: %s" % training_job_name )
66
- PyTorch .attach (training_job_name = training_job_name , sagemaker_session = sagemaker_session )
65
+ if not _is_local_mode (instance_type ):
66
+ with timeout (minutes = 35 ):
67
+ print ("Re-attaching now to: %s" % training_job_name )
68
+ PyTorch .attach (training_job_name = training_job_name , sagemaker_session = sagemaker_session )
67
69
68
70
69
71
def test_failed_training_job (sagemaker_session , pytorch_full_version , instance_type ):
@@ -81,4 +83,8 @@ def test_failed_training_job(sagemaker_session, pytorch_full_version, instance_t
81
83
82
84
def _upload_training_data (pytorch ):
83
85
return pytorch .sagemaker_session .upload_data (path = os .path .join (MNIST_DIR , 'training' ),
84
- key_prefix = 'integ-test-data/pytorch_mnist/training' )
86
+ key_prefix = 'integ-test-data/pytorch_mnist/training' )
87
+
88
+
89
+ def _is_local_mode (instance_type ):
90
+ return instance_type == 'local'
0 commit comments