Skip to content

Commit 787924f

Browse files
authored
fix: use model id instead of model name in undeployModelAsync (GoogleCloudPlatform#8986)
1 parent c8492d7 commit 787924f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

aiplatform/src/main/java/aiplatform/UndeployModelSample.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.cloud.aiplatform.v1.EndpointName;
2323
import com.google.cloud.aiplatform.v1.EndpointServiceClient;
2424
import com.google.cloud.aiplatform.v1.EndpointServiceSettings;
25-
import com.google.cloud.aiplatform.v1.ModelName;
2625
import com.google.cloud.aiplatform.v1.UndeployModelOperationMetadata;
2726
import com.google.cloud.aiplatform.v1.UndeployModelResponse;
2827
import java.io.IOException;
@@ -57,7 +56,6 @@ static void undeployModelSample(String project, String endpointId, String modelI
5756
EndpointServiceClient.create(endpointServiceSettings)) {
5857
String location = "us-central1";
5958
EndpointName endpointName = EndpointName.of(project, location, endpointId);
60-
ModelName modelName = ModelName.of(project, location, modelId);
6159

6260
// key '0' assigns traffic for the newly deployed model
6361
// Traffic percentage values must add up to 100
@@ -66,7 +64,7 @@ static void undeployModelSample(String project, String endpointId, String modelI
6664

6765
OperationFuture<UndeployModelResponse, UndeployModelOperationMetadata> operation =
6866
endpointServiceClient.undeployModelAsync(
69-
endpointName.toString(), modelName.toString(), trafficSplit);
67+
endpointName.toString(), modelId, trafficSplit);
7068
System.out.format("Operation name: %s\n", operation.getInitialFuture().get().getName());
7169
System.out.println("Waiting for operation to finish...");
7270
UndeployModelResponse undeployModelResponse = operation.get(180, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)