acrites commented on code in PR #29963:
URL: https://github.com/apache/beam/pull/29963#discussion_r1456494613
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/streaming/ActiveWorkState.java:
##########
@@ -120,6 +123,42 @@ synchronized ActivateWorkResult
activateWorkForKey(ShardedKey shardedKey, Work w
return ActivateWorkResult.QUEUED;
}
+ public static class FailedTokens {
+ public long workToken;
+ public long cacheToken;
+
+ public FailedTokens(long workToken, long cacheToken) {
+ this.workToken = workToken;
+ this.cacheToken = cacheToken;
+ }
+ }
+
+ synchronized void failWorkForKey(Map<Long, List<FailedTokens>> failedWork) {
+ // Note we can't construct a ShardedKey and look it up in activeWork
directly since
+ // HeartbeatResponse doesn't include the user key.
+ for (Entry<ShardedKey, Deque<Work>> entry : activeWork.entrySet()) {
+ List<FailedTokens> failedTokens =
failedWork.get(entry.getKey().shardingKey());
+ if (failedTokens == null) continue;
+ for (FailedTokens failedToken : failedTokens) {
+ for (Work queuedWork : entry.getValue()) {
+ WorkItem workItem = queuedWork.getWorkItem();
+ if (workItem.getWorkToken() == failedToken.workToken
+ && workItem.getCacheToken() == failedToken.cacheToken) {
+ LOG.error(
+ "failing work "
+ + entry.getKey().shardingKey()
Review Comment:
I don't think I have access to the computation in `ActiveWorkState`. In
theory `computationStateCache` has it, but it's private. I can add an accessor
method if you think it's useful here.
--
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]