SinBex commented on code in PR #21695:
URL: https://github.com/apache/flink/pull/21695#discussion_r1081134730


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/slowtaskdetector/ExecutionTimeBasedSlowTaskDetector.java:
##########
@@ -225,10 +244,56 @@ private long getExecutionTime(final Execution execution, 
final long currentTime)
         }
     }
 
+    private long getExecutionInputNumBytes(final Execution execution) {
+        return execution.getVertex().getExecutionVertexInputNumBytes();
+    }
+
+    private ExecutionTimeWithInputNumBytes getExecutionTimeAndInputNumBytes(
+            Execution execution, final long currentTime) {
+        long executionTime = getExecutionTime(execution, currentTime);
+        long executionInputNumBytes = getExecutionInputNumBytes(execution);
+
+        return new ExecutionTimeWithInputNumBytes(executionTime, 
executionInputNumBytes);
+    }
+
     @Override
     public void stop() {
         if (scheduledDetectionFuture != null) {
             scheduledDetectionFuture.cancel(false);
         }
     }
+
+    /** This class defines the execution time and input number bytes for an 
execution. */
+    @VisibleForTesting
+    static class ExecutionTimeWithInputNumBytes
+            implements Comparable<ExecutionTimeWithInputNumBytes> {
+
+        private final long executionTime;
+        private final long inputNumBytes;
+
+        public ExecutionTimeWithInputNumBytes(long executionTime, long 
inputNumBytes) {
+            this.executionTime = executionTime;
+            this.inputNumBytes = inputNumBytes;
+        }
+
+        public long getExecutionTime() {
+            return executionTime;
+        }
+
+        public long getInputNumBytes() {
+            return inputNumBytes;
+        }
+
+        @Override
+        public int compareTo(ExecutionTimeWithInputNumBytes other) {
+            // We should guarantee that all sorted elements' inputNumBytes are 
all zero or non-zero,
+            // otherwise it may cause ambiguity.

Review Comment:
   fix this



-- 
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