[ 
https://issues.apache.org/jira/browse/FLINK-20364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17239056#comment-17239056
 ] 

Guruh Fajar Samudra commented on FLINK-20364:
---------------------------------------------

Github user GJL commented on a diff in the pull request:

[https://github.com/apache/flink/pull/5091#discussion_r155590317]

— Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java
 —
@@ -266,104 +279,367 @@ public void disconnectResourceManager() {
// ------------------------------------------------------------------------

@Override
 - public CompletableFuture<SimpleSlot> allocateSlot(
 - SlotRequestID requestId,
 - ScheduledUnit task,
 - ResourceProfile resources,
 - Iterable<TaskManagerLocation> locationPreferences,
+ public CompletableFuture<LogicalSlot> allocateSlot(
+ SlotRequestId slotRequestId,
+ ScheduledUnit scheduledUnit,
+ ResourceProfile resourceProfile,
+ Collection<TaskManagerLocation> locationPreferences,
+ boolean allowQueuedScheduling,
Time timeout) \{ - return internalAllocateSlot(requestId, task, resources, 
locationPreferences); + return internalAllocateSlot( + slotRequestId, + 
scheduledUnit, + resourceProfile, + locationPreferences, + 
allowQueuedScheduling); }

 - @Override
 - public void returnAllocatedSlot(Slot slot) {
 - internalReturnAllocatedSlot(slot);
+ private CompletableFuture<LogicalSlot> internalAllocateSlot(
+ SlotRequestId slotRequestId,
+ ScheduledUnit task,
+ ResourceProfile resourceProfile,
+ Collection<TaskManagerLocation> locationPreferences,
+ boolean allowQueuedScheduling) {
+
+ final SlotSharingGroupId slotSharingGroupId = task.getSlotSharingGroupId();
+
+ if (slotSharingGroupId != null) {
+ // allocate slot with slot sharing
+ final SlotSharingManager multiTaskSlotManager = 
slotSharingManagers.computeIfAbsent(
+ slotSharingGroupId,
+ id -> new SlotSharingManager(
+ id,
+ this,
+ providerAndOwner));
+
+ final SlotSharingManager.MultiTaskSlotLocality multiTaskSlotFuture;
+
+ try
Unknown macro: \{ + if (task.getCoLocationConstraint() != null) { + 
multiTaskSlotFuture = allocateCoLocatedMultiTaskSlot( + 
task.getCoLocationConstraint(), + multiTaskSlotManager, + resourceProfile, + 
locationPreferences, + allowQueuedScheduling); + } else \{ + 
multiTaskSlotFuture = allocateMultiTaskSlot( + task.getJobVertexId(), 
multiTaskSlotManager, + resourceProfile, + locationPreferences, + 
allowQueuedScheduling); + } + }
catch (NoResourceAvailableException noResourceException)
{ + return FutureUtils.completedExceptionally(noResourceException); + }
+
+ // sanity check
+ 
Preconditions.checkState(!multiTaskSlotFuture.getMultiTaskSlot().contains(task.getJobVertexId()));
+
+ final SlotSharingManager.SingleTaskSlot leave = 
multiTaskSlotFuture.getMultiTaskSlot().allocateSingleTaskSlot(

 -- 
 --- End diff –

nit: variable name should be *pin*

[https://travelingpin.com/|https://travelingpin.com/]

> Add support for scheduling with slot sharing
> --------------------------------------------
>
>                 Key: FLINK-20364
>                 URL: https://issues.apache.org/jira/browse/FLINK-20364
>             Project: Flink
>          Issue Type: Test
>          Components: Runtime / Coordination
>    Affects Versions: statefun-2.2.1
>            Reporter: Guruh Fajar Samudra
>            Priority: Major
>             Fix For: statefun-2.2.2
>
>
> In order to reach feature equivalence with the old code base, we should add 
> support for scheduling with slot sharing to the SlotPool. This will also 
> allow us to run all the IT cases based on the {{AbstractTestBase}} on the 
> Flip-6 {{MiniCluster}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to