File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
aiplatform/snippets/src/test/java/aiplatform Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1919import static com .google .common .truth .Truth .assertThat ;
2020import static junit .framework .TestCase .assertNotNull ;
2121
22+ import io .grpc .StatusRuntimeException ;
2223import java .io .ByteArrayOutputStream ;
2324import java .io .IOException ;
2425import java .io .PrintStream ;
@@ -75,7 +76,22 @@ public void tearDown()
7576 TimeUnit .MINUTES .sleep (2 );
7677
7778 // 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+ }
7995
8096 // Assert
8197 String deleteResponse = bout .toString ();
You can’t perform that action at this time.
0 commit comments