zentol commented on a change in pull request #14950: URL: https://github.com/apache/flink/pull/14950#discussion_r585421476
########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/StateTrackingMockExecutionGraph.java ########## @@ -0,0 +1,342 @@ +/* + * 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.adaptive; + +import org.apache.flink.api.common.ArchivedExecutionConfig; +import org.apache.flink.api.common.ExecutionConfig; +import org.apache.flink.api.common.JobID; +import org.apache.flink.api.common.JobStatus; +import org.apache.flink.api.common.accumulators.Accumulator; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.runtime.JobException; +import org.apache.flink.runtime.accumulators.AccumulatorSnapshot; +import org.apache.flink.runtime.accumulators.StringifiedAccumulatorResult; +import org.apache.flink.runtime.checkpoint.CheckpointCoordinator; +import org.apache.flink.runtime.checkpoint.CheckpointIDCounter; +import org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot; +import org.apache.flink.runtime.checkpoint.CheckpointStatsTracker; +import org.apache.flink.runtime.checkpoint.CheckpointsCleaner; +import org.apache.flink.runtime.checkpoint.CompletedCheckpointStore; +import org.apache.flink.runtime.checkpoint.MasterTriggerRestoreHook; +import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor; +import org.apache.flink.runtime.executiongraph.ErrorInfo; +import org.apache.flink.runtime.executiongraph.Execution; +import org.apache.flink.runtime.executiongraph.ExecutionAttemptID; +import org.apache.flink.runtime.executiongraph.ExecutionGraph; +import org.apache.flink.runtime.executiongraph.ExecutionJobVertex; +import org.apache.flink.runtime.executiongraph.ExecutionVertex; +import org.apache.flink.runtime.executiongraph.IntermediateResult; +import org.apache.flink.runtime.executiongraph.JobStatusListener; +import org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition; +import org.apache.flink.runtime.executiongraph.failover.flip1.ResultPartitionAvailabilityChecker; +import org.apache.flink.runtime.io.network.partition.ResultPartitionID; +import org.apache.flink.runtime.jobgraph.IntermediateDataSetID; +import org.apache.flink.runtime.jobgraph.JobVertex; +import org.apache.flink.runtime.jobgraph.JobVertexID; +import org.apache.flink.runtime.jobgraph.tasks.CheckpointCoordinatorConfiguration; +import org.apache.flink.runtime.query.KvStateLocationRegistry; +import org.apache.flink.runtime.scheduler.InternalFailuresListener; +import org.apache.flink.runtime.scheduler.strategy.SchedulingTopology; +import org.apache.flink.runtime.state.CheckpointStorage; +import org.apache.flink.runtime.state.StateBackend; +import org.apache.flink.util.OptionalFailure; +import org.apache.flink.util.SerializedValue; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +/** + * Mocked ExecutionGraph which (partially) tracks the job status, and provides some basic mocks to + * create an {@link org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph} from this + * ExecutionGraph. + */ +class StateTrackingMockExecutionGraph implements ExecutionGraph { + private JobStatus state = JobStatus.INITIALIZING; + private final CompletableFuture<JobStatus> terminationFuture = new CompletableFuture<>(); + private final JobID jobId = new JobID(); + private final ArchivedExecutionConfig archivedExecutionConfig = new ExecutionConfig().archive(); Review comment: this one could be static ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/RestartingTest.java ########## @@ -148,8 +134,8 @@ public Restarting createRestartingState( public Restarting createRestartingState(MockRestartingContext ctx) throws JobException, JobExecutionException { - ExecutionGraph executionGraph = TestingExecutionGraphBuilder.newBuilder().build(); - return createRestartingState(ctx, executionGraph); + // ExecutionGraph executionGraph = TestingDefaultExecutionGraphBuilder.newBuilder().build(); Review comment: . ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphDeploymentWithBlobServerTest.java ########## @@ -87,7 +87,7 @@ public void shutdownBlobServer() throws IOException { } @Override - protected void checkJobOffloaded(ExecutionGraph eg) throws Exception { + protected void checkJobOffloaded(DefaultExecutionGraph eg) throws Exception { Review comment: this seems incorrect? ########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java ########## @@ -309,7 +313,7 @@ public AllocationID getLatestPriorAllocation() { } } - public ExecutionGraph getExecutionGraph() { + public InternalExecutionGraphAccessor getExecutionAccessor() { Review comment: ```suggestion public InternalExecutionGraphAccessor getExecutionGraphAccessor() { ``` ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphDeploymentWithBlobServerTest.java ########## @@ -87,7 +87,7 @@ public void shutdownBlobServer() throws IOException { } @Override - protected void checkJobOffloaded(ExecutionGraph eg) throws Exception { + protected void checkJobOffloaded(DefaultExecutionGraph eg) throws Exception { Review comment: Oh, `getJobInformationOrBlobKey` is not part of the EG interface... :/ ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphRescalingTest.java ########## @@ -58,7 +58,8 @@ public void testExecutionGraphArbitraryDopConstructionTest() throws Exception { createVerticesForSimpleBipartiteJobGraph(initialParallelism, maxParallelism); final JobGraph jobGraph = new JobGraph(jobVertices); - ExecutionGraph eg = TestingExecutionGraphBuilder.newBuilder().setJobGraph(jobGraph).build(); Review comment: should this test (and others) be renamed to refer to the `DefaultExecutionGraph`? ---------------------------------------------------------------- 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