Izeren commented on code in PR #27719:
URL: https://github.com/apache/flink/pull/27719#discussion_r2877351648
##########
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.java:
##########
@@ -159,38 +173,43 @@ void testCancelWhileRestarting() throws Exception {
new DefaultSchedulerBuilder(
createJobGraph(),
mainThreadExecutor,
- EXECUTOR_RESOURCE.getExecutor())
+ EXECUTOR_EXTENSION.getExecutor())
.setExecutionSlotAllocatorFactory(
createExecutionSlotAllocatorFactory(slotPool))
.setRestartBackoffTimeStrategy(
new TestRestartBackoffTimeStrategy(true,
Long.MAX_VALUE))
.setDelayExecutor(taskRestartExecutor)
.build();
- ExecutionGraph executionGraph = scheduler.getExecutionGraph();
- startScheduling(scheduler);
+ mainThreadExecutor.execute(
+ () -> {
+ ExecutionGraph executionGraph =
scheduler.getExecutionGraph();
- final ResourceID taskManagerResourceId = offerSlots(slotPool,
NUM_TASKS);
+ startScheduling(scheduler);
- // Release the TaskManager and wait for the job to restart
- slotPool.releaseTaskManager(taskManagerResourceId, new
Exception("Test Exception"));
-
assertThat(executionGraph.getState()).isEqualTo(JobStatus.RESTARTING);
+ final ResourceID taskManagerResourceId =
offerSlots(slotPool, NUM_TASKS);
- // Canceling needs to abort the restart
- scheduler.cancel();
+ // Release the TaskManager and wait for the job to
restart
+ slotPool.releaseTaskManager(
+ taskManagerResourceId, new Exception("Test
Exception"));
+
assertThat(executionGraph.getState()).isEqualTo(JobStatus.RESTARTING);
-
assertThat(executionGraph.getState()).isEqualTo(JobStatus.CANCELED);
+ // Canceling needs to abort the restart
+ scheduler.cancel();
- taskRestartExecutor.triggerScheduledTasks();
+
assertThat(executionGraph.getState()).isEqualTo(JobStatus.CANCELED);
-
assertThat(executionGraph.getState()).isEqualTo(JobStatus.CANCELED);
- for (ExecutionVertex vertex :
executionGraph.getAllExecutionVertices()) {
-
assertThat(vertex.getExecutionState()).isEqualTo(ExecutionState.FAILED);
- }
+ taskRestartExecutor.triggerScheduledTasks();
+
+
assertThat(executionGraph.getState()).isEqualTo(JobStatus.CANCELED);
+ for (ExecutionVertex vertex :
executionGraph.getAllExecutionVertices()) {
+
assertThat(vertex.getExecutionState()).isEqualTo(ExecutionState.FAILED);
+ }
+ });
}
}
- private static ResourceID offerSlots(SlotPool slotPool, int numSlots) {
+ private ResourceID offerSlots(SlotPool slotPool, int numSlots) {
Review Comment:
+1
--
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]