Search in sources :

Example 1 with DatasetServiceClient

use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient in project java-aiplatform by googleapis.

the class ImportDataVideoObjectTrackingSampleTest method tearDown.

@After
public void tearDown() throws InterruptedException, ExecutionException, IOException {
    // delete the temp dataset
    if (datasetId != null) {
        DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
        try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
            DatasetName datasetName = DatasetName.of(PROJECT, LOCATION, datasetId);
            OperationFuture<Empty, DeleteOperationMetadata> operationFuture = datasetServiceClient.deleteDatasetAsync(datasetName);
            operationFuture.get();
        }
    }
    System.out.flush();
    System.setOut(originalPrintStream);
}
Also used : Empty(com.google.protobuf.Empty) DatasetServiceSettings(com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1beta1.DatasetName) DeleteOperationMetadata(com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata) DatasetServiceClient(com.google.cloud.aiplatform.v1beta1.DatasetServiceClient) After(org.junit.After)

Example 2 with DatasetServiceClient

use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient in project java-aiplatform by googleapis.

the class ImportDataVideoObjectTrackingSampleTest method setUp.

@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException, IOException {
    bout = new ByteArrayOutputStream();
    out = new PrintStream(bout);
    originalPrintStream = System.out;
    System.setOut(out);
    // create a temp dataset for importing data
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        String metadataSchemaUri = "gs://google-cloud-aiplatform/schema/dataset/metadata/video_1.0.0.yaml";
        LocationName locationName = LocationName.of(PROJECT, LOCATION);
        Dataset dataset = Dataset.newBuilder().setDisplayName("test_dataset_display_name").setMetadataSchemaUri(metadataSchemaUri).build();
        OperationFuture<Dataset, CreateDatasetOperationMetadata> datasetFuture = datasetServiceClient.createDatasetAsync(locationName, dataset);
        Dataset datasetResponse = datasetFuture.get(300, TimeUnit.SECONDS);
        String[] datasetValues = datasetResponse.getName().split("/");
        datasetId = datasetValues[datasetValues.length - 1];
    }
}
Also used : PrintStream(java.io.PrintStream) DatasetServiceSettings(com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings) CreateDatasetOperationMetadata(com.google.cloud.aiplatform.v1beta1.CreateDatasetOperationMetadata) Dataset(com.google.cloud.aiplatform.v1beta1.Dataset) DatasetServiceClient(com.google.cloud.aiplatform.v1beta1.DatasetServiceClient) ByteArrayOutputStream(java.io.ByteArrayOutputStream) LocationName(com.google.cloud.aiplatform.v1beta1.LocationName) Before(org.junit.Before)

Example 3 with DatasetServiceClient

use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient in project java-aiplatform by googleapis.

the class ImportDataImageObjectDetectionSampleTest method setUp.

@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException, IOException {
    bout = new ByteArrayOutputStream();
    out = new PrintStream(bout);
    originalPrintStream = System.out;
    System.setOut(out);
    // create a temp dataset for importing data
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        String metadataSchemaUri = "gs://google-cloud-aiplatform/schema/dataset/metadata/image_1.0.0.yaml";
        LocationName locationName = LocationName.of(PROJECT, LOCATION);
        Dataset dataset = Dataset.newBuilder().setDisplayName("test_dataset_display_name").setMetadataSchemaUri(metadataSchemaUri).build();
        OperationFuture<Dataset, CreateDatasetOperationMetadata> datasetFuture = datasetServiceClient.createDatasetAsync(locationName, dataset);
        Dataset datasetResponse = datasetFuture.get(120, TimeUnit.SECONDS);
        String[] datasetValues = datasetResponse.getName().split("/");
        datasetId = datasetValues[datasetValues.length - 1];
    }
}
Also used : PrintStream(java.io.PrintStream) DatasetServiceSettings(com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings) CreateDatasetOperationMetadata(com.google.cloud.aiplatform.v1beta1.CreateDatasetOperationMetadata) Dataset(com.google.cloud.aiplatform.v1beta1.Dataset) DatasetServiceClient(com.google.cloud.aiplatform.v1beta1.DatasetServiceClient) ByteArrayOutputStream(java.io.ByteArrayOutputStream) LocationName(com.google.cloud.aiplatform.v1beta1.LocationName) Before(org.junit.Before)

Example 4 with DatasetServiceClient

use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient in project java-aiplatform by googleapis.

the class ImportDataImageObjectDetectionSampleTest method tearDown.

@After
public void tearDown() throws InterruptedException, ExecutionException, IOException, TimeoutException {
    // delete the temp dataset
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        DatasetName datasetName = DatasetName.of(PROJECT, LOCATION, datasetId);
        OperationFuture<Empty, DeleteOperationMetadata> operationFuture = datasetServiceClient.deleteDatasetAsync(datasetName);
        operationFuture.get();
    }
    System.out.flush();
    System.setOut(originalPrintStream);
}
Also used : Empty(com.google.protobuf.Empty) DatasetServiceSettings(com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1beta1.DatasetName) DeleteOperationMetadata(com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata) DatasetServiceClient(com.google.cloud.aiplatform.v1beta1.DatasetServiceClient) After(org.junit.After)

Example 5 with DatasetServiceClient

use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient in project java-aiplatform by googleapis.

the class ImportDataVideoActionRecognitionSampleTest method tearDown.

@After
public void tearDown() throws InterruptedException, ExecutionException, IOException {
    // delete the temp dataset
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        DatasetName datasetName = DatasetName.of(PROJECT, LOCATION, datasetId);
        OperationFuture<Empty, DeleteOperationMetadata> operationFuture = datasetServiceClient.deleteDatasetAsync(datasetName);
        operationFuture.get();
    }
    System.out.flush();
    System.setOut(originalPrintStream);
}
Also used : Empty(com.google.protobuf.Empty) DatasetServiceSettings(com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1beta1.DatasetName) DeleteOperationMetadata(com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata) DatasetServiceClient(com.google.cloud.aiplatform.v1beta1.DatasetServiceClient) After(org.junit.After)

Aggregations

DatasetServiceClient (com.google.cloud.aiplatform.v1.DatasetServiceClient)15 DatasetServiceSettings (com.google.cloud.aiplatform.v1.DatasetServiceSettings)15 DatasetServiceClient (com.google.cloud.aiplatform.v1beta1.DatasetServiceClient)10 DatasetServiceSettings (com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings)10 DatasetName (com.google.cloud.aiplatform.v1.DatasetName)9 GcsSource (com.google.cloud.aiplatform.v1.GcsSource)8 ImportDataConfig (com.google.cloud.aiplatform.v1.ImportDataConfig)8 ImportDataOperationMetadata (com.google.cloud.aiplatform.v1.ImportDataOperationMetadata)8 ImportDataResponse (com.google.cloud.aiplatform.v1.ImportDataResponse)8 CreateDatasetOperationMetadata (com.google.cloud.aiplatform.v1.CreateDatasetOperationMetadata)6 Dataset (com.google.cloud.aiplatform.v1.Dataset)6 LocationName (com.google.cloud.aiplatform.v1.LocationName)6 Empty (com.google.protobuf.Empty)6 CreateDatasetOperationMetadata (com.google.cloud.aiplatform.v1beta1.CreateDatasetOperationMetadata)5 Dataset (com.google.cloud.aiplatform.v1beta1.Dataset)5 DatasetName (com.google.cloud.aiplatform.v1beta1.DatasetName)5 DeleteOperationMetadata (com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata)5 LocationName (com.google.cloud.aiplatform.v1beta1.LocationName)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 PrintStream (java.io.PrintStream)5