tillrohrmann commented on a change in pull request #9072: [FLINK-11630] Wait 
for the termination of all running Tasks when shutting down TaskExecutor
URL: https://github.com/apache/flink/pull/9072#discussion_r313902827
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TaskExecutorTest.java
 ##########
 @@ -760,6 +767,79 @@ public void invoke() throws Exception {
                }
        }
 
+       @Test
+       public void testTaskInterruptionAndTerminationOnShutdown() throws 
Exception {
+               final CompletableFuture<Void> taskSlotTableStarted = new 
CompletableFuture<>();
+               final TaskSlotTable taskSlotTable = new 
TaskSlotTableWithStartFuture(taskSlotTableStarted, timerService);
+               final JobMasterId jobMasterId = JobMasterId.generate();
+               final AllocationID allocationId = new AllocationID();
+               final TaskDeploymentDescriptor taskDeploymentDescriptor =
+                       
createTaskDeploymentDescriptor(TestInterruptableInvokable.class, allocationId);
+               final TaskExecutor taskExecutor = createTaskExecutor(new 
TaskManagerServicesBuilder()
+                       .setTaskSlotTable(taskSlotTable)
+                       
.setJobManagerTable(createJobManagerTableWithOneJob(jobMasterId))
+                       .build());
+
+               try {
+                       taskExecutor.start();
+                       taskSlotTableStarted.get();
+                       taskSlotTable.allocateSlot(0, jobId, allocationId, 
timeout);
 
 Review comment:
   This is dangerous, as we are mutating state from the testing thread which is 
actually owned by the `TaskExecutor's` rpc main thread. Better to call 
`TaskExecutorGateway#requestSlot` after registering a `ResourceManagerGateway`.

----------------------------------------------------------------
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


With regards,
Apache Git Services

Reply via email to