File tree 1 file changed +17
-1
lines changed
aiplatform/snippets/src/test/java/aiplatform
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 19
19
import static com .google .common .truth .Truth .assertThat ;
20
20
import static junit .framework .TestCase .assertNotNull ;
21
21
22
+ import io .grpc .StatusRuntimeException ;
22
23
import java .io .ByteArrayOutputStream ;
23
24
import java .io .IOException ;
24
25
import java .io .PrintStream ;
@@ -75,7 +76,22 @@ public void tearDown()
75
76
TimeUnit .MINUTES .sleep (2 );
76
77
77
78
// Delete the Training Pipeline
78
- DeleteTrainingPipelineSample .deleteTrainingPipelineSample (PROJECT , trainingPipelineId );
79
+ int retryCount = 3 ;
80
+ while (retryCount > 0 ) {
81
+ retryCount --;
82
+ try {
83
+ DeleteTrainingPipelineSample .deleteTrainingPipelineSample (PROJECT , trainingPipelineId );
84
+ // if delete operation is successful, break out of the loop and continue
85
+ break ;
86
+ } catch (StatusRuntimeException | ExecutionException ex ) {
87
+ // wait for another 1 minute, then retry
88
+ System .out .println ("Retrying (due to unfinished cancellation operation)..." );
89
+ TimeUnit .MINUTES .sleep (1 );
90
+ } catch (Exception otherExceptions ) {
91
+ // other exception, let them throw
92
+ throw otherExceptions ;
93
+ }
94
+ }
79
95
80
96
// Assert
81
97
String deleteResponse = bout .toString ();
You can’t perform that action at this time.
0 commit comments