tillrohrmann commented on a change in pull request #9663: 
[WIP][FLINK-12433][runtime] Implement DefaultScheduler stub
URL: https://github.com/apache/flink/pull/9663#discussion_r324081835
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/DefaultSchedulerTest.java
 ##########
 @@ -0,0 +1,335 @@
+/*
+ * 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;
+
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.api.common.time.Time;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.JobManagerOptions;
+import org.apache.flink.runtime.blob.VoidBlobWriter;
+import org.apache.flink.runtime.checkpoint.StandaloneCheckpointRecoveryFactory;
+import org.apache.flink.runtime.clusterframework.types.SlotProfile;
+import 
org.apache.flink.runtime.concurrent.ComponentMainThreadExecutorServiceAdapter;
+import org.apache.flink.runtime.concurrent.ManuallyTriggeredScheduledExecutor;
+import org.apache.flink.runtime.execution.ExecutionState;
+import org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex;
+import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
+import org.apache.flink.runtime.executiongraph.failover.FailoverStrategyLoader;
+import 
org.apache.flink.runtime.executiongraph.failover.flip1.RestartPipelinedRegionStrategy;
+import 
org.apache.flink.runtime.executiongraph.failover.flip1.TestRestartBackoffTimeStrategy;
+import org.apache.flink.runtime.executiongraph.utils.SimpleSlotProvider;
+import org.apache.flink.runtime.io.network.partition.NoOpPartitionTracker;
+import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.jobgraph.JobStatus;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.jobgraph.JobVertexID;
+import org.apache.flink.runtime.jobgraph.ScheduleMode;
+import org.apache.flink.runtime.jobmanager.scheduler.ScheduledUnit;
+import org.apache.flink.runtime.jobmaster.SlotRequestId;
+import org.apache.flink.runtime.metrics.groups.UnregisteredMetricGroups;
+import 
org.apache.flink.runtime.rest.handler.legacy.backpressure.VoidBackPressureStatsTracker;
+import org.apache.flink.runtime.scheduler.strategy.EagerSchedulingStrategy;
+import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
+import 
org.apache.flink.runtime.scheduler.strategy.LazyFromSourcesSchedulingStrategy;
+import org.apache.flink.runtime.shuffle.NettyShuffleMaster;
+import org.apache.flink.runtime.taskmanager.TaskExecutionState;
+import org.apache.flink.runtime.testtasks.NoOpInvokable;
+import org.apache.flink.runtime.testutils.DirectScheduledExecutorService;
+import org.apache.flink.util.Preconditions;
+import org.apache.flink.util.TestLogger;
+
+import org.apache.flink.shaded.guava18.com.google.common.collect.Iterables;
+
+import org.hamcrest.Matchers;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests for {@link DefaultScheduler}.
+ */
+public class DefaultSchedulerTest extends TestLogger {
+
+       private static final int TIMEOUT_MS = 1000;
+
+       private static final JobID TEST_JOB_ID = new JobID();
+
+       private ManuallyTriggeredScheduledExecutor taskRestartExecutor = new 
ManuallyTriggeredScheduledExecutor();
+
+       private ExecutorService executor;
+
+       private ScheduledExecutorService scheduledExecutorService;
+
+       private Configuration configuration;
+
+       private SubmissionTrackingTaskManagerGateway testTaskManagerGateway;
+
+       private TestRestartBackoffTimeStrategy testRestartBackoffTimeStrategy;
+
+       private FailingExecutionVertexOperationsDecorator 
testExecutionVertexOperations;
+
+       private SimpleSlotProvider slotProvider;
+
+       private ExecutionVertexVersioner executionVertexVersioner;
+
+       @Before
+       public void setUp() throws Exception {
+               executor = Executors.newSingleThreadExecutor();
+               scheduledExecutorService = new DirectScheduledExecutorService();
+
+               configuration = new Configuration();
+               
configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, 
FailoverStrategyLoader.NO_OP_FAILOVER_STRATEGY);
+               testTaskManagerGateway = new 
SubmissionTrackingTaskManagerGateway();
+
+               testRestartBackoffTimeStrategy = new 
TestRestartBackoffTimeStrategy(true, 0);
+
+               testExecutionVertexOperations = new 
FailingExecutionVertexOperationsDecorator(new 
DefaultExecutionVertexOperations());
+
+               slotProvider = new SimpleSlotProvider(TEST_JOB_ID, 12, 
testTaskManagerGateway);
+
+               executionVertexVersioner = new ExecutionVertexVersioner();
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               if (scheduledExecutorService != null) {
+                       scheduledExecutorService.shutdownNow();
+                       scheduledExecutorService.awaitTermination(TIMEOUT_MS, 
TimeUnit.MILLISECONDS);
+               }
+
+               if (executor != null) {
+                       executor.shutdownNow();
+                       executor.awaitTermination(TIMEOUT_MS, 
TimeUnit.MILLISECONDS);
+               }
+       }
+
+       @Test
+       public void startScheduling() {
+               final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
+               final JobVertex onlyJobVertex = getOnlyJobVertex(jobGraph);
+
+               createSchedulerAndStartScheduling(jobGraph);
+
+               final List<ExecutionVertexID> deployedExecutionVertices = 
testTaskManagerGateway.getDeployedExecutionVertices(1, TIMEOUT_MS);
+
+               final ExecutionVertexID executionVertexId = new 
ExecutionVertexID(onlyJobVertex.getID(), 0);
+               assertThat(deployedExecutionVertices, 
contains(executionVertexId));
+       }
+
+       @Test
+       public void restartAfterDeploymentFails() {
+               final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
+               final JobVertex onlyJobVertex = getOnlyJobVertex(jobGraph);
+
+               testExecutionVertexOperations.enableFailDeploy();
 
 Review comment:
   because there is no concurrency, right?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to