zhuzhurk commented on code in PR #20296: URL: https://github.com/apache/flink/pull/20296#discussion_r932927829
########## flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ArchivedExecutionGraphTestUtils.java: ########## @@ -0,0 +1,168 @@ +/* + * 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.executiongraph; + +import org.apache.flink.runtime.accumulators.StringifiedAccumulatorResult; +import org.apache.flink.runtime.execution.ExecutionState; +import org.apache.flink.util.OptionalFailure; +import org.apache.flink.util.SerializedValue; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ArchivedExecutionGraphTestUtils { Review Comment: This util class and its methods can be package private ########## flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/JobVertexTaskManagersHandler.java: ########## @@ -175,45 +180,48 @@ private static JobVertexTaskManagersInfo createJobVertexTaskManagersInfo( MutableIOMetrics counts = new MutableIOMetrics(); - for (AccessExecutionVertex vertex : taskVertices) { - final ExecutionState state = vertex.getExecutionState(); - tasksPerState[state.ordinal()]++; + int representativeAttemptsCount = 0; + for (AccessExecution execution : executions) { + final ExecutionState state = execution.getState(); + executionsPerState[state.ordinal()]++; + if (representativeExecutions.contains(execution)) { + tasksPerState[state.ordinal()]++; + representativeAttemptsCount += 1; Review Comment: nit: representativeAttemptsCount++; ########## flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ArchivedExecutionVertexWithSpeculativeExecutionTest.java: ########## @@ -0,0 +1,268 @@ +/* + * 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.executiongraph; + +import org.apache.flink.api.common.JobStatus; +import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutorServiceAdapter; +import org.apache.flink.runtime.execution.ExecutionState; +import org.apache.flink.runtime.jobgraph.JobGraph; +import org.apache.flink.runtime.jobgraph.JobGraphTestUtils; +import org.apache.flink.runtime.jobgraph.JobVertex; +import org.apache.flink.runtime.scheduler.TestingInternalFailuresListener; +import org.apache.flink.testutils.TestingUtils; +import org.apache.flink.testutils.executor.TestExecutorExtension; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; + +import static org.assertj.core.api.Assertions.assertThat; + +/** Tests for the {@link SpeculativeExecutionVertex}. */ +class ArchivedExecutionVertexWithSpeculativeExecutionTest { + + @RegisterExtension + private static final TestExecutorExtension<ScheduledExecutorService> EXECUTOR_RESOURCE = + TestingUtils.defaultExecutorExtension(); + + private TestingInternalFailuresListener internalFailuresListener; + + @BeforeEach + void setUp() { + internalFailuresListener = new TestingInternalFailuresListener(); + } + + @Test + void testCreateSpeculativeExecution() throws Exception { + final SpeculativeExecutionVertex ev = createSpeculativeExecutionVertex(); + assertThat(ev.getCurrentExecutions()).hasSize(1); Review Comment: This comment also applies to other tests in this class. ########## flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ArchivedExecutionGraphTestUtils.java: ########## @@ -0,0 +1,168 @@ +/* + * 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.executiongraph; + +import org.apache.flink.runtime.accumulators.StringifiedAccumulatorResult; +import org.apache.flink.runtime.execution.ExecutionState; +import org.apache.flink.util.OptionalFailure; +import org.apache.flink.util.SerializedValue; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ArchivedExecutionGraphTestUtils { Review Comment: The util class should have a private constructor to avoid being instantiated. A reference is SchedulerTestingUtils. -- 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]
