This is an automated email from the ASF dual-hosted git repository. zhuzh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit a0e8818d6967e5b0d14367d2095c91a05cadfe1f Author: hongli <[email protected]> AuthorDate: Thu Jun 23 11:04:00 2022 +0800 [FLINK-28135][runtime] Introduce SlowTaskDetector This closes #20054. --- .../slowtaskdetector/SlowTaskDetector.java | 36 ++++++++++++++++++++ .../slowtaskdetector/SlowTaskDetectorListener.java | 38 ++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/slowtaskdetector/SlowTaskDetector.java b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/slowtaskdetector/SlowTaskDetector.java new file mode 100644 index 00000000000..a8bce9244d9 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/slowtaskdetector/SlowTaskDetector.java @@ -0,0 +1,36 @@ +/* + * 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.scheduler.slowtaskdetector; + +import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor; +import org.apache.flink.runtime.executiongraph.ExecutionGraph; + +/** Component responsible for detecting slow tasks. */ +public interface SlowTaskDetector { + + /** Start detecting slow tasks periodically. */ + void start( + ExecutionGraph executionGraph, + SlowTaskDetectorListener listener, + ComponentMainThreadExecutor mainThreadExecutor); + + /** Stop detecting slow tasks. */ + void stop(); +} diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/slowtaskdetector/SlowTaskDetectorListener.java b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/slowtaskdetector/SlowTaskDetectorListener.java new file mode 100644 index 00000000000..9aa466fcdfa --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/slowtaskdetector/SlowTaskDetectorListener.java @@ -0,0 +1,38 @@ +/* + * 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.scheduler.slowtaskdetector; + +import org.apache.flink.runtime.executiongraph.ExecutionAttemptID; +import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID; + +import java.util.Collection; +import java.util.Map; + +/** Component responsible for listening on slow tasks. */ +public interface SlowTaskDetectorListener { + + /** + * Notify detected slow tasks. + * + * @param slowTasks the map of execution vertices and their execution attempts which are + * detected as slow. + */ + void notifySlowTasks(Map<ExecutionVertexID, Collection<ExecutionAttemptID>> slowTasks); +}
