Skip to content

Commit 78975d2

Browse files
authored
Merge branch 'master' into master
2 parents 6353618 + 3d5bbad commit 78975d2

File tree

42 files changed

+976
-284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+976
-284
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pom.xml.next
2424
release.properties
2525
dependency-reduced-pom.xml
2626
buildNumber.properties
27+
.checkstyle
2728

2829
# Secrets
2930
service-account.json

appengine-java8/guestbook-cloud-datastore/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<dependency>
9191
<groupId>com.google.appengine</groupId>
9292
<artifactId>appengine-testing</artifactId>
93-
<version>1.9.76</version>
93+
<version>1.9.77</version>
9494
<scope>test</scope>
9595
</dependency>
9696
<dependency>

appengine-java8/guestbook-objectify/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<dependency>
9090
<groupId>com.google.appengine</groupId>
9191
<artifactId>appengine-testing</artifactId>
92-
<version>1.9.76</version>
92+
<version>1.9.77</version>
9393
<scope>test</scope>
9494
</dependency>
9595
<dependency>

appengine-java8/multitenancy/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<dependency>
8989
<groupId>com.google.appengine</groupId>
9090
<artifactId>appengine-testing</artifactId>
91-
<version>1.9.76</version>
91+
<version>1.9.77</version>
9292
<scope>test</scope>
9393
</dependency>
9494
<dependency>

appengine-java8/taskqueues-pull/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Copyright 2016 Google Inc.
6262
<dependency>
6363
<groupId>com.google.appengine</groupId>
6464
<artifactId>appengine-testing</artifactId>
65-
<version>1.9.76</version>
65+
<version>1.9.77</version>
6666
<scope>test</scope>
6767
</dependency>
6868
<dependency>

appengine-java8/users/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Copyright 2015 Google Inc.
7878
<dependency>
7979
<groupId>com.google.appengine</groupId>
8080
<artifactId>appengine-testing</artifactId>
81-
<version>1.9.76</version>
81+
<version>1.9.77</version>
8282
<scope>test</scope>
8383
</dependency>
8484
<dependency>

automl/cloud-client/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ small section of code to print out the `metadata` field.
6363
* [Deploy Model](src/main/java/com/example/automl/DeployModel.java) - Not supported by Translation
6464
* [Uneploy Model](src/main/java/com/example/automl/UndeployModel.java) - Not supported by Translation
6565

66+
### Batch Prediction
67+
* [Batch Predict](src/main/java/com/example/automl/BatchPredict.java) - Supported by: Natural Language Entity Extraction, Vision Classification, and Vision Object Detection.
6668

6769
### Operation Management
6870
* [List Operation Statuses](src/main/java/com/example/automl/ListOperationStatus.java)

automl/cloud-client/src/main/java/com/example/automl/LanguageBatchPredict.java renamed to automl/cloud-client/src/main/java/com/example/automl/BatchPredict.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.example.automl;
1818

19-
// [START automl_language_batch_predict]
19+
// [START automl_batch_predict]
2020
import com.google.api.gax.longrunning.OperationFuture;
2121
import com.google.cloud.automl.v1.BatchPredictInputConfig;
2222
import com.google.cloud.automl.v1.BatchPredictOutputConfig;
@@ -31,19 +31,19 @@
3131
import java.io.IOException;
3232
import java.util.concurrent.ExecutionException;
3333

34-
class LanguageBatchPredict {
34+
class BatchPredict {
3535

3636
static void batchPredict() throws IOException, ExecutionException, InterruptedException {
3737
// TODO(developer): Replace these variables before running the sample.
3838
String projectId = "YOUR_PROJECT_ID";
3939
String modelId = "YOUR_MODEL_ID";
40-
String inputUri = "gs://YOUR_BUCKET_ID/path_to_your_input_file.jsonl";
40+
String inputUri = "gs://YOUR_BUCKET_ID/path_to_your_input_csv_or_jsonl";
4141
String outputUri = "gs://YOUR_BUCKET_ID/path_to_save_results/";
4242
batchPredict(projectId, modelId, inputUri, outputUri);
4343
}
4444

4545
static void batchPredict(String projectId, String modelId, String inputUri, String outputUri)
46-
throws IOException, ExecutionException, InterruptedException {
46+
throws IOException, ExecutionException, InterruptedException {
4747
// Initialize client that will be used to send requests. This client only needs to be created
4848
// once, and can be reused for multiple requests. After completing all of your requests, call
4949
// the "close" method on the client to safely clean up any remaining background resources.
@@ -52,25 +52,27 @@ static void batchPredict(String projectId, String modelId, String inputUri, Stri
5252
ModelName name = ModelName.of(projectId, "us-central1", modelId);
5353
GcsSource gcsSource = GcsSource.newBuilder().addInputUris(inputUri).build();
5454
BatchPredictInputConfig inputConfig =
55-
BatchPredictInputConfig.newBuilder().setGcsSource(gcsSource).build();
55+
BatchPredictInputConfig.newBuilder().setGcsSource(gcsSource).build();
5656
GcsDestination gcsDestination =
57-
GcsDestination.newBuilder().setOutputUriPrefix(outputUri).build();
57+
GcsDestination.newBuilder().setOutputUriPrefix(outputUri).build();
5858
BatchPredictOutputConfig outputConfig =
59-
BatchPredictOutputConfig.newBuilder().setGcsDestination(gcsDestination).build();
59+
BatchPredictOutputConfig.newBuilder().setGcsDestination(gcsDestination).build();
6060
BatchPredictRequest request =
61-
BatchPredictRequest.newBuilder()
62-
.setName(name.toString())
63-
.setInputConfig(inputConfig)
64-
.setOutputConfig(outputConfig)
65-
.build();
61+
BatchPredictRequest.newBuilder()
62+
.setName(name.toString())
63+
.setInputConfig(inputConfig)
64+
.setOutputConfig(outputConfig)
65+
// [0.0-1.0] Only produce results higher than this value
66+
.putParams("score_threshold", "0.8")
67+
.build();
6668

6769
OperationFuture<BatchPredictResult, OperationMetadata> future =
68-
client.batchPredictAsync(request);
70+
client.batchPredictAsync(request);
6971

7072
System.out.println("Waiting for operation to complete...");
7173
BatchPredictResult response = future.get();
7274
System.out.println("Batch Prediction results saved to specified Cloud Storage bucket.");
7375
}
7476
}
7577
}
76-
// [END automl_language_batch_predict]
78+
// [END automl_batch_predict]

automl/cloud-client/src/main/java/com/example/automl/VisionBatchPredict.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

automl/cloud-client/src/test/java/com/example/automl/LanguageEntityExtractionPredictIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void testBatchPredict() throws IOException, ExecutionException, Interrupt
8686
String inputUri = String.format("gs://%s/entity_extraction/input.jsonl", BUCKET_ID);
8787
String outputUri = String.format("gs://%s/TEST_BATCH_PREDICT/", BUCKET_ID);
8888
// Act
89-
LanguageBatchPredict.batchPredict(PROJECT_ID, modelId, inputUri, outputUri);
89+
BatchPredict.batchPredict(PROJECT_ID, modelId, inputUri, outputUri);
9090

9191
// Assert
9292
String got = bout.toString();

automl/cloud-client/src/test/java/com/example/automl/VisionClassificationPredictIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void testBatchPredict() throws IOException, ExecutionException, Interrupt
8686
String inputUri = String.format("gs://%s/batch_predict_test.csv", BUCKET_ID);
8787
String outputUri = String.format("gs://%s/TEST_BATCH_PREDICT/", BUCKET_ID);
8888
// Act
89-
VisionBatchPredict.batchPredict(PROJECT_ID, modelId, inputUri, outputUri);
89+
BatchPredict.batchPredict(PROJECT_ID, modelId, inputUri, outputUri);
9090

9191
// Assert
9292
String got = bout.toString();

automl/cloud-client/src/test/java/com/example/automl/VisionObjectDetectionPredictIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void testBatchPredict() throws IOException, ExecutionException, Interrupt
8888
String.format("gs://%s/vision_object_detection_batch_predict_test.csv", BUCKET_ID);
8989
String outputUri = String.format("gs://%s/TEST_BATCH_PREDICT/", BUCKET_ID);
9090
// Act
91-
VisionBatchPredict.batchPredict(PROJECT_ID, modelId, inputUri, outputUri);
91+
BatchPredict.batchPredict(PROJECT_ID, modelId, inputUri, outputUri);
9292

9393
// Assert
9494
String got = bout.toString();

bigtable/snippets/src/main/java/com/example/bigtable/WriteBatch.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public static void writeBatch(String projectId, String instanceId, String tableI
3333

3434
try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) {
3535
long timestamp = System.currentTimeMillis() * 1000;
36-
ByteString one = ByteString.copyFrom(new byte[] {0, 0, 0, 0, 0, 0, 0, 1});
3736

3837
BulkMutation bulkMutation =
3938
BulkMutation.create(tableId)
@@ -44,7 +43,7 @@ public static void writeBatch(String projectId, String instanceId, String tableI
4443
COLUMN_FAMILY_NAME,
4544
ByteString.copyFrom("connected_wifi".getBytes()),
4645
timestamp,
47-
one)
46+
1)
4847
.setCell(COLUMN_FAMILY_NAME, "os_build", timestamp, "12155.0.0-rc1"))
4948
.add(
5049
"tablet#a0b81f74#20190502",
@@ -53,7 +52,7 @@ public static void writeBatch(String projectId, String instanceId, String tableI
5352
COLUMN_FAMILY_NAME,
5453
ByteString.copyFrom("connected_wifi".getBytes()),
5554
timestamp,
56-
one)
55+
1)
5756
.setCell(COLUMN_FAMILY_NAME, "os_build", timestamp, "12155.0.0-rc6"));
5857

5958
dataClient.bulkMutateRows(bulkMutation);

bigtable/snippets/src/main/java/com/example/bigtable/WriteSimple.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,19 @@ public static void writeSimple(String projectId, String instanceId, String table
3434
long timestamp = System.currentTimeMillis() * 1000;
3535

3636
String rowkey = "phone#4c410523#20190501";
37-
ByteString one = ByteString.copyFrom(new byte[] {0, 0, 0, 0, 0, 0, 0, 1});
3837

3938
RowMutation rowMutation =
4039
RowMutation.create(tableId, rowkey)
4140
.setCell(
4241
COLUMN_FAMILY_NAME,
4342
ByteString.copyFrom("connected_cell".getBytes()),
4443
timestamp,
45-
one)
44+
1)
4645
.setCell(
4746
COLUMN_FAMILY_NAME,
4847
ByteString.copyFrom("connected_wifi".getBytes()),
4948
timestamp,
50-
one)
49+
1)
5150
.setCell(COLUMN_FAMILY_NAME, "os_build", timestamp, "PQ2A.190405.003");
5251

5352
dataClient.mutateRow(rowMutation);

datacatalog/cloud-client/src/main/java/com/example/datacatalog/CreateFilesetEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static void createEntry(String projectId, String entryGroupId, String ent
5454
.setDisplayName("My Fileset")
5555
.setDescription("This fileset consists of ....")
5656
.setGcsFilesetSpec(
57-
GcsFilesetSpec.newBuilder().addFilePatterns("gs://my_bucket/*").build())
57+
GcsFilesetSpec.newBuilder().addFilePatterns("gs://cloud-samples-data/*").build())
5858
.setSchema(
5959
Schema.newBuilder()
6060
.addColumns(

0 commit comments

Comments
 (0)