use of com.google.cloud.aiplatform.v1.DeleteOperationMetadata in project java-aiplatform by googleapis.
the class DeleteBatchPredictionJobSample method deleteBatchPredictionJobSample.
static void deleteBatchPredictionJobSample(String project, String batchPredictionJobId) throws IOException, InterruptedException, ExecutionException, TimeoutException {
JobServiceSettings jobServiceSettings = JobServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
// the "close" method on the client to safely clean up any remaining background resources.
try (JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings)) {
String location = "us-central1";
BatchPredictionJobName batchPredictionJobName = BatchPredictionJobName.of(project, location, batchPredictionJobId);
OperationFuture<Empty, DeleteOperationMetadata> operationFuture = jobServiceClient.deleteBatchPredictionJobAsync(batchPredictionJobName);
System.out.format("Operation name: %s\n", operationFuture.getInitialFuture().get().getName());
System.out.println("Waiting for operation to finish...");
operationFuture.get(300, TimeUnit.SECONDS);
System.out.println("Deleted Batch Prediction Job.");
}
}
Aggregations