Search in sources :

Example 1 with DataLabelingJobName

use of com.google.cloud.aiplatform.v1.DataLabelingJobName in project java-aiplatform by googleapis.

the class DeleteDataLabelingJobSample method deleteDataLabelingJob.

static void deleteDataLabelingJob(String project, String dataLabelingJobId) 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";
        DataLabelingJobName dataLabelingJobName = DataLabelingJobName.of(project, location, dataLabelingJobId);
        OperationFuture<Empty, DeleteOperationMetadata> operationFuture = jobServiceClient.deleteDataLabelingJobAsync(dataLabelingJobName);
        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.format("Deleted Data Labeling Job.");
    }
}
Also used : JobServiceSettings(com.google.cloud.aiplatform.v1.JobServiceSettings) Empty(com.google.protobuf.Empty) DeleteOperationMetadata(com.google.cloud.aiplatform.v1.DeleteOperationMetadata) JobServiceClient(com.google.cloud.aiplatform.v1.JobServiceClient) DataLabelingJobName(com.google.cloud.aiplatform.v1.DataLabelingJobName)

Example 2 with DataLabelingJobName

use of com.google.cloud.aiplatform.v1.DataLabelingJobName in project java-aiplatform by googleapis.

the class CancelDataLabelingJobSample method cancelDataLabelingJob.

static void cancelDataLabelingJob(String project, String dataLabelingJobId) throws IOException {
    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";
        DataLabelingJobName dataLabelingJobName = DataLabelingJobName.of(project, location, dataLabelingJobId);
        jobServiceClient.cancelDataLabelingJob(dataLabelingJobName);
        System.out.println("Cancelled Data labeling job");
    }
}
Also used : JobServiceSettings(com.google.cloud.aiplatform.v1.JobServiceSettings) JobServiceClient(com.google.cloud.aiplatform.v1.JobServiceClient) DataLabelingJobName(com.google.cloud.aiplatform.v1.DataLabelingJobName)

Aggregations

DataLabelingJobName (com.google.cloud.aiplatform.v1.DataLabelingJobName)2 JobServiceClient (com.google.cloud.aiplatform.v1.JobServiceClient)2 JobServiceSettings (com.google.cloud.aiplatform.v1.JobServiceSettings)2 DeleteOperationMetadata (com.google.cloud.aiplatform.v1.DeleteOperationMetadata)1 Empty (com.google.protobuf.Empty)1