azagrebin commented on a change in pull request #10330: [FLINK-14189][runtime]
Extend TaskExecutor to support dynamic slot allocation
URL: https://github.com/apache/flink/pull/10330#discussion_r352204987
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
##########
@@ -196,16 +217,21 @@ public SlotReport createSlotReport(ResourceID
resourceId) {
public boolean allocateSlot(int index, JobID jobId, AllocationID
allocationId, Time slotTimeout) {
checkInit();
+ Preconditions.checkArgument(index < numberSlots);
+
TaskSlot taskSlot = allocationIDTaskSlotMap.get(allocationId);
if (taskSlot != null) {
LOG.info("Allocation ID {} is already allocated in
{}.", allocationId, taskSlot);
return false;
}
- taskSlot = taskSlots.get(index);
+
+ taskSlot = new TaskSlot(index, defaultSlotResourceProfile,
memoryPageSize);
boolean result = taskSlot.allocate(jobId, allocationId);
if (result) {
+ taskSlots.put(index, taskSlot);
Review comment:
`result` should be always `true` for the newly created slot but we could
sanity-check whether `taskSlots` contains the `index`, basically non-freed slot.
----------------------------------------------------------------
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