Skip to content

Commit

Permalink
fix: use model id instead of model name in undeployModelAsync (#8986)
Browse files Browse the repository at this point in the history
  • Loading branch information
mithenks committed Jan 31, 2024
1 parent c8492d7 commit 787924f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions aiplatform/src/main/java/aiplatform/UndeployModelSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.google.cloud.aiplatform.v1.EndpointName;
import com.google.cloud.aiplatform.v1.EndpointServiceClient;
import com.google.cloud.aiplatform.v1.EndpointServiceSettings;
import com.google.cloud.aiplatform.v1.ModelName;
import com.google.cloud.aiplatform.v1.UndeployModelOperationMetadata;
import com.google.cloud.aiplatform.v1.UndeployModelResponse;
import java.io.IOException;
Expand Down Expand Up @@ -57,7 +56,6 @@ static void undeployModelSample(String project, String endpointId, String modelI
EndpointServiceClient.create(endpointServiceSettings)) {
String location = "us-central1";
EndpointName endpointName = EndpointName.of(project, location, endpointId);
ModelName modelName = ModelName.of(project, location, modelId);

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

OperationFuture<UndeployModelResponse, UndeployModelOperationMetadata> operation =
endpointServiceClient.undeployModelAsync(
endpointName.toString(), modelName.toString(), trafficSplit);
endpointName.toString(), modelId, trafficSplit);
System.out.format("Operation name: %s\n", operation.getInitialFuture().get().getName());
System.out.println("Waiting for operation to finish...");
UndeployModelResponse undeployModelResponse = operation.get(180, TimeUnit.SECONDS);
Expand Down

0 comments on commit 787924f

Please sign in to comment.