You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/11/29 19:19:44 UTC

[GitHub] [flink] azagrebin commented on a change in pull request #10330: [FLINK-14189][runtime] Extend TaskExecutor to support dynamic slot allocation

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:
users@infra.apache.org


With regards,
Apache Git Services