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.");
}
}
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");
}
}
Aggregations