File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
tests/integ/sagemaker/lineage Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change 1515
1616import uuid
1717from datetime import datetime
18+ import time
1819
1920
2021def name ():
@@ -30,3 +31,16 @@ def names():
3031 )
3132 for i in range (3 )
3233 ]
34+
35+
36+ def retry (callable , num_attempts = 8 ):
37+ assert num_attempts >= 1
38+ for i in range (num_attempts ):
39+ try :
40+ return callable ()
41+ except Exception as ex :
42+ if i == num_attempts - 1 :
43+ raise ex
44+ print ("Retrying" , ex )
45+ time .sleep (2 ** i )
46+ assert False , "logic error in retry"
Original file line number Diff line number Diff line change 2020import pytest
2121
2222from sagemaker .lineage import artifact
23+ from tests .integ .sagemaker .lineage .helpers import retry
2324
2425
2526def test_create_delete (artifact_obj ):
@@ -103,14 +104,20 @@ def test_list_by_type(artifact_objs, sagemaker_session):
103104
104105def test_downstream_trials (trial_associated_artifact , trial_obj , sagemaker_session ):
105106 # allow trial components to index, 30 seconds max
106- for i in range (3 ):
107- time .sleep (10 )
108- trials = trial_associated_artifact .downstream_trials (sagemaker_session = sagemaker_session )
109- if len (trials ) > 0 :
110- break
107+ def validate ():
108+ for i in range (3 ):
109+ time .sleep (10 )
110+ trials = trial_associated_artifact .downstream_trials (
111+ sagemaker_session = sagemaker_session
112+ )
113+ logging .info (f"Found { len (trials )} downstream trials." )
114+ if len (trials ) > 0 :
115+ break
116+
117+ assert len (trials ) == 1
118+ assert trial_obj .trial_name in trials
111119
112- assert len (trials ) == 1
113- assert trial_obj .trial_name in trials
120+ retry (validate , num_attempts = 3 )
114121
115122
116123@pytest .mark .timeout (30 )
You can’t perform that action at this time.
0 commit comments