Skip to content

Commit 32173ce

Browse files
authored
samples: increased wait time for undeployed model prediction (#3286)
* samples: increased wait time for undeployed model prediction * fixed the lint issue
1 parent f102af8 commit 32173ce

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

vision/automl/src/test/java/com/google/cloud/vision/samples/automl/PredictionApiIT.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
import java.io.IOException;
2727
import java.io.PrintStream;
2828
import java.util.concurrent.ExecutionException;
29+
import java.util.concurrent.Future;
30+
import java.util.concurrent.TimeUnit;
31+
import java.util.concurrent.TimeoutException;
2932
import org.junit.After;
3033
import org.junit.Before;
3134
import org.junit.Test;
@@ -45,7 +48,8 @@ public class PredictionApiIT {
4548
private PrintStream out;
4649

4750
@Before
48-
public void setUp() throws IOException, ExecutionException, InterruptedException {
51+
public void setUp()
52+
throws IOException, ExecutionException, InterruptedException, TimeoutException {
4953
// Verify that the model is deployed for prediction
5054
try (AutoMlClient client = AutoMlClient.create()) {
5155
ModelName modelFullId = ModelName.of(PROJECT_ID, "us-central1", modelId);
@@ -54,7 +58,8 @@ public void setUp() throws IOException, ExecutionException, InterruptedException
5458
// Deploy the model if not deployed
5559
DeployModelRequest request =
5660
DeployModelRequest.newBuilder().setName(modelFullId.toString()).build();
57-
client.deployModelAsync(request).get();
61+
Future future = client.deployModelAsync(request);
62+
future.get(30, TimeUnit.MINUTES);
5863
}
5964
}
6065

0 commit comments

Comments
 (0)