igorbernstein2 commented on code in PR #17823:
URL: https://github.com/apache/beam/pull/17823#discussion_r918030980
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableConfig.java:
##########
@@ -97,6 +102,14 @@ abstract Builder setBigtableOptionsConfigurator(
abstract Builder setEmulatorHost(String emulatorHost);
+ /**
+ * This feature is used to report back the client's throttling time to a
Dataflow job. This will
+ * reduce the number of workers during a Dataflow bulk mutation job.
+ *
+ * <p>{@link BigtableIO.Write}
+ */
+ abstract Builder setDataflowThrottleReporting(boolean isEnabled);
Review Comment:
Please be consistent: either mark all of the new package private members as
Experimental or none of them
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -1431,4 +1484,30 @@ static void validateTableExists(BigtableConfig config,
PipelineOptions options)
}
}
}
+
+ interface ResourceStatsSupplier {
+ ResourceLimiterStats getStats();
+ }
+
+ private static class ResourceStatsSupplierImpl implements
ResourceStatsSupplier, Serializable {
+
+ private final BigtableConfig bigtableConfig;
+
+ ResourceStatsSupplierImpl(BigtableConfig bigtableConfig) {
+ this.bigtableConfig = bigtableConfig;
+ }
+
+ @Override
+ public ResourceLimiterStats getStats() {
+ if (bigtableConfig.getProjectId() == null ||
bigtableConfig.getInstanceId() == null) {
+ return ResourceLimiterStats.getInstance(
+ new BigtableInstanceName(
+ bigtableConfig.getBigtableOptions().getProjectId(),
+ bigtableConfig.getBigtableOptions().getInstanceId()));
+ }
+ return ResourceLimiterStats.getInstance(
+ new BigtableInstanceName(
+ bigtableConfig.getProjectId().get(),
bigtableConfig.getInstanceId().get()));
+ }
+ }
Review Comment:
I think it would more clear to factor out the instantiation:
String projectId = bigtableConfig.getProjectId();
if (projectId == null) {
projectId = bigtableConfig.getBigtableOptions().getProjectId();
}
...
InstanceName name = new BigtableInstanceName(projectId...);
return ResourceLimiterStats.getInstance(name);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]