rkhachatryan commented on a change in pull request #17387:
URL: https://github.com/apache/flink/pull/17387#discussion_r747583663
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TaskExecutorTest.java
##########
@@ -2536,6 +2484,61 @@ public void testDynamicSlotAllocation() throws Exception
{
}
}
+ @Test
+ public void testReleasingJobResources() throws Exception {
+ AllocationID[] slots =
+ range(0, 5).mapToObj(i -> new
AllocationID()).toArray(AllocationID[]::new);
+ try (TaskExecutorTestingContext ctx =
createTaskExecutorTestingContext(slots.length)) {
+ ctx.start();
+ ResourceManagerId rmId;
+ {
+ CompletableFuture<Tuple3<ResourceID, InstanceID, SlotReport>>
+ initialSlotReportFuture = new CompletableFuture<>();
+ rmId =
createAndRegisterResourceManager(initialSlotReportFuture);
+ initialSlotReportFuture.get();
+ }
+
+ TaskExecutorGateway gateway =
+ ctx.taskExecutor.getSelfGateway(TaskExecutorGateway.class);
+
+ for (int i = 0; i < slots.length; i++) {
+ requestSlot(
+ gateway,
+ jobId,
+ slots[i],
+ buildSlotID(i),
+ ResourceProfile.UNKNOWN,
+ ctx.jobMasterGateway.getAddress(),
+ rmId);
+ }
+ ExecutionAttemptID attemptID =
+ submitNoOpInvokableTask(
+ slots[0], new
TestingJobMasterGatewayBuilder().build(), gateway);
+
assertNotNull(ctx.changelogStoragesManager.getChangelogStoragesByJobId(jobId));
+ assertNotNull(ctx.metricGroup.getJobMetricsGroup(jobId));
+
+ // cancel tasks before releasing the slots - so that TM will
release job resources on
+ // the last slot release
+ gateway.cancelTask(attemptID, timeout).get();
+ while (ctx.taskSlotTable.getTasks(jobId).hasNext()) {
Review comment:
Good point.
--
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]