zhijiangW commented on a change in pull request #10083: 
[FLINK-14472][runtime]Implement back-pressure monitor with non-blocking outputs.
URL: https://github.com/apache/flink/pull/10083#discussion_r342979874
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskBackPressureSampleService.java
 ##########
 @@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.flink.runtime.taskexecutor;
+
+import org.apache.flink.api.common.time.Time;
+import org.apache.flink.runtime.concurrent.ScheduledExecutor;
+
+import javax.annotation.Nonnegative;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+
+import static java.util.Objects.requireNonNull;
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+/**
+ * Samples the output buffer availability of tasks for back pressure tracking.
+ *
+ * @see 
org.apache.flink.runtime.rest.handler.legacy.backpressure.BackPressureStatsTracker
+ */
+class TaskBackPressureSampleService {
+
+       private final ScheduledExecutor scheduledExecutor;
+
+       TaskBackPressureSampleService(final ScheduledExecutor 
scheduledExecutor) {
+               this.scheduledExecutor = requireNonNull(scheduledExecutor, "The 
scheduledExecutor must not be null.");
+       }
+
+       /**
+        * Returns a future that completes with the back pressure ratio of a 
task.
+        *
+        * @param task                The task to be sampled.
+        * @param numSamples          The number of samples.
+        * @param delayBetweenSamples The time to wait between samples.
+        * @return A future containing the task back pressure ratio.
+        */
+       public CompletableFuture<Double> sampleTaskBackPressure(
+                       final OutputAvailabilitySampleableTask task,
+                       @Nonnegative final int numSamples,
 
 Review comment:
   `@Nonnegative` is duplicate with below `checkArgument(numSamples > 0, "The 
numSamples must be positive.");`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to