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/12/02 06:51:51 UTC

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

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

 ##########
 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:
   True, `result` should always be `true`. The idea here is to make `TaskSlotTable` independent from the implementation of `TaskSlot`, only stick to the its contract (which is that `TaskSlot#allocate` might fail).
   
   Agree that we should do sanity check on the duplicated `index`.

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