xintongsong commented on code in PR #20111:
URL: https://github.com/apache/flink/pull/20111#discussion_r910765394


##########
flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/SubtaskExecutionAttemptDetailsInfo.java:
##########
@@ -237,6 +256,57 @@ public static SubtaskExecutionAttemptDetailsInfo create(
                 endTime,
                 duration,
                 ioMetricsInfo,
-                taskmanagerId);
+                taskmanagerId,
+                getExecutionStateDuration(execution));
+    }
+
+    private static Map<ExecutionState, Long> 
getExecutionStateDuration(AccessExecution execution) {
+        Map<ExecutionState, Long> executionStateDuration = new HashMap<>();
+        long now = System.currentTimeMillis();
+        ExecutionState state = execution.getState();
+        executionStateDuration.put(
+                ExecutionState.CREATED,
+                calculateStateDuration(
+                        execution.getStateTimestamp(ExecutionState.CREATED),
+                        execution.getStateEndTimestamp(ExecutionState.CREATED),
+                        state == ExecutionState.CREATED ? now : 0));

Review Comment:
   ```suggestion
           executionStateDuration.put(
                   ExecutionState.CREATED,
                   calculateStateDuration(
                           execution.getStateTimestamp(ExecutionState.CREATED),
                           state == ExecutionState.CREATED ? now : 
execution.getStateEndTimestamp(ExecutionState.CREATED)));
   ```
   
   I think this helps prevent the implicity that indicating the current state 
with `now != 0`.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to