m-trieu commented on code in PR #30695:
URL: https://github.com/apache/beam/pull/30695#discussion_r1539815800
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java:
##########
@@ -489,26 +465,67 @@ static StreamingDataflowWorker forTesting(
boolean publishCounters,
HotKeyLogger hotKeyLogger,
Supplier<Instant> clock,
- Function<String, ScheduledExecutorService> executorSupplier) {
- BoundedQueueExecutor boundedQueueExecutor =
createWorkUnitExecutor(options);
+ Function<String, ScheduledExecutorService> executorSupplier,
+ int localRetryTimeoutMs) {
+ ConcurrentMap<String, StageInfo> stageInfo = new ConcurrentHashMap<>();
+ BoundedQueueExecutor workExecutor = createWorkUnitExecutor(options);
WindmillStateCache stateCache =
WindmillStateCache.ofSizeMbs(options.getWorkerCacheMb());
computationMap.putAll(
- createComputationMapForTesting(mapTasks, boundedQueueExecutor,
stateCache::forComputation));
+ createComputationMapForTesting(mapTasks, workExecutor,
stateCache::forComputation));
+ MemoryMonitor memoryMonitor = MemoryMonitor.fromOptions(options);
+ StreamingCounters streamingCounters = StreamingCounters.create();
+ FailureReporter failureReporter =
+ options.isEnableStreamingEngine()
+ ? StreamingEngineFailureReporter.create(
+ MAX_FAILURES_TO_REPORT_IN_UPDATE,
options.getMaxStackTraceDepthToReport())
+ : StreamingApplianceFailureReporter.create(
+ MAX_FAILURES_TO_REPORT_IN_UPDATE,
+ options.getMaxStackTraceDepthToReport(),
+ windmillServer::reportStats);
+ WorkFailureProcessor workFailureProcessor =
+ new WorkFailureProcessor(
+ workExecutor,
+ failureReporter,
+ () -> Optional.ofNullable(memoryMonitor.tryToDumpHeap()),
+ clock,
+ localRetryTimeoutMs);
+ StreamingWorkerStatusReporter workerStatusReporter =
+ StreamingWorkerStatusReporter.forTesting(
+ publishCounters,
+ workUnitClient,
+ windmillServer::getAndResetThrottleTime,
+ stageInfo::values,
+ failureReporter,
+ streamingCounters,
+ memoryMonitor,
+ workExecutor,
+ () -> chooseMaxThreads(options),
+ executorSupplier);
return new StreamingDataflowWorker(
windmillServer,
1L,
computationMap,
+ stageInfo,
stateCache,
- boundedQueueExecutor,
+ workExecutor,
mapTaskExecutorFactory,
workUnitClient,
options,
- publishCounters,
hotKeyLogger,
clock,
+ workerStatusReporter,
+ failureReporter,
+ workFailureProcessor,
+ streamingCounters,
+ memoryMonitor,
executorSupplier);
}
+ @VisibleForTesting
+ public final void reportPeriodicWorkerUpdatesForTest() {
Review Comment:
done
--
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]