Search in sources :

Example 11 with DeleteOperationMetadata

use of com.google.cloud.aiplatform.v1beta1.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.");
    }
}
Also used : JobServiceSettings(com.google.cloud.aiplatform.v1.JobServiceSettings) Empty(com.google.protobuf.Empty) BatchPredictionJobName(com.google.cloud.aiplatform.v1.BatchPredictionJobName) DeleteOperationMetadata(com.google.cloud.aiplatform.v1.DeleteOperationMetadata) JobServiceClient(com.google.cloud.aiplatform.v1.JobServiceClient)

Aggregations

Empty (com.google.protobuf.Empty)11 DeleteOperationMetadata (com.google.cloud.aiplatform.v1.DeleteOperationMetadata)6 DatasetName (com.google.cloud.aiplatform.v1beta1.DatasetName)5 DatasetServiceClient (com.google.cloud.aiplatform.v1beta1.DatasetServiceClient)5 DatasetServiceSettings (com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings)5 DeleteOperationMetadata (com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata)5 After (org.junit.After)5 JobServiceClient (com.google.cloud.aiplatform.v1.JobServiceClient)2 JobServiceSettings (com.google.cloud.aiplatform.v1.JobServiceSettings)2 BatchPredictionJobName (com.google.cloud.aiplatform.v1.BatchPredictionJobName)1 DataLabelingJobName (com.google.cloud.aiplatform.v1.DataLabelingJobName)1 DatasetName (com.google.cloud.aiplatform.v1.DatasetName)1 DatasetServiceClient (com.google.cloud.aiplatform.v1.DatasetServiceClient)1 DatasetServiceSettings (com.google.cloud.aiplatform.v1.DatasetServiceSettings)1 EndpointName (com.google.cloud.aiplatform.v1.EndpointName)1 EndpointServiceClient (com.google.cloud.aiplatform.v1.EndpointServiceClient)1 EndpointServiceSettings (com.google.cloud.aiplatform.v1.EndpointServiceSettings)1 ModelName (com.google.cloud.aiplatform.v1.ModelName)1 ModelServiceClient (com.google.cloud.aiplatform.v1.ModelServiceClient)1 ModelServiceSettings (com.google.cloud.aiplatform.v1.ModelServiceSettings)1