arunpandianp commented on code in PR #31902:
URL: https://github.com/apache/beam/pull/31902#discussion_r1805681740
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java:
##########
@@ -482,8 +565,58 @@ public static StreamingDataflowWorker
fromOptions(DataflowWorkerHarnessOptions o
computationStateCache =
computationStateCacheFactory.apply(configFetcher);
}
- return ConfigFetcherComputationStateCacheAndWindmillClient.create(
- configFetcher, computationStateCache, windmillServer,
windmillStreamFactory);
+ return builder
+ .setConfigFetcher(configFetcher)
+ .setComputationStateCache(computationStateCache)
+ .setWindmillServer(windmillServer)
+ .setWindmillStreamFactory(windmillStreamFactory)
+ .build();
+ }
+
+ private static boolean isDirectPathPipeline(DataflowWorkerHarnessOptions
options) {
+ if (options.isEnableStreamingEngine() &&
options.getIsWindmillServiceDirectPathEnabled()) {
+ boolean isIpV6Enabled =
+ Optional.ofNullable(options.getDataflowServiceOptions())
+ .map(serviceOptions ->
serviceOptions.contains(ENABLE_IPV6_EXPERIMENT))
+ .orElse(false);
+ if (isIpV6Enabled) {
+ return true;
+ }
+ LOG.warn(
+ "DirectPath is currently only supported with IPv6 networking stack.
Defaulting to"
+ + " CloudPath.");
+ }
+ return false;
+ }
+
+ private static void validateWorkerOptions(DataflowWorkerHarnessOptions
options) {
+ Preconditions.checkArgument(
+ options.isStreaming(),
+ "%s instantiated with options indicating batch use",
+ StreamingDataflowWorker.class.getName());
+
+ Preconditions.checkArgument(
+ !DataflowRunner.hasExperiment(options, BEAM_FN_API_EXPERIMENT),
+ "%s cannot be main() class with beam_fn_api enabled",
+ StreamingDataflowWorker.class.getSimpleName());
+ }
+
+ private static ChannelCachingStubFactory createStubFactory(
+ DataflowWorkerHarnessOptions workerOptions) {
+ Function<WindmillServiceAddress, ManagedChannel> channelFactory =
+ serviceAddress ->
+ remoteChannel(
+ serviceAddress,
workerOptions.getWindmillServiceRpcChannelAliveTimeoutSec());
+ ChannelCache channelCache =
+ ChannelCache.create(
+ serviceAddress ->
+ // IsolationChannel will create and manage separate RPC
channels to the same
+ // serviceAddress via calling the channelFactory, else just
directly return the
+ // RPC channel.
+ workerOptions.getUseWindmillIsolatedChannels()
Review Comment:
Thinking more, will it be better to default to isolated channels enabled?
That'll be the closest to what we'll have in cloud path after
https://github.com/apache/beam/pull/32782
--
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]