scwhittle commented on code in PR #35120:
URL: https://github.com/apache/beam/pull/35120#discussion_r2137726995
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ExecutionStateSampler.java:
##########
@@ -357,6 +377,19 @@ private void takeSample(long currentTimeMillis, long
millisSinceLastSample) {
transitionsAtLastSample = transitionsAtThisSample;
} else {
long lullTimeMs = currentTimeMillis - lastTransitionTimeMillis.get();
+
+ try {
+ if (lullTimeMs >
TimeUnit.MINUTES.toMillis(lullTimeMinuteForRestart)) {
+ throw new TimeoutException(
+ String.format(
+ "The ptransform has been stuck for more than %d minutes,
the SDK worker will"
+ + " restart",
+ lullTimeMinuteForRestart));
+ }
+ } catch (TimeoutException e) {
+ LOG.error(e.getMessage());
Review Comment:
I think that you could change the ExecutionStateSampler construction to take
in some function to call when this timeout has happened. Then for unit test you
could just pass in some lambda that notifies a completablefuture or
countdownlatch and verify it is called. In the real harness, you could pass in
a function that call System.exit or otherwise ends up terminating the harness.
--
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]