public class SlotSharingManager extends Object
The SlotSharingManager allows to create a hierarchy of SlotSharingManager.TaskSlot
such that every SlotSharingManager.TaskSlot
is uniquely identified by a SlotRequestId
identifying the request for the
TaskSlot and a AbstractID
identifying the task or the co-location constraint running in
this slot.
The SlotSharingManager.TaskSlot
hierarchy is implemented by SlotSharingManager.MultiTaskSlot
and SlotSharingManager.SingleTaskSlot
. The former class represents inner nodes which can contain a number of other
SlotSharingManager.TaskSlot
and the latter class represents the leaf nodes. The hierarchy starts with a root
SlotSharingManager.MultiTaskSlot
which is a future SlotContext
assigned. The SlotContext
represents the allocated slot on the TaskExecutor in which all slots of this hierarchy run. A
SlotSharingManager.MultiTaskSlot
can be assigned multiple SlotSharingManager.SingleTaskSlot
or SlotSharingManager.MultiTaskSlot
if
and only if the task slot does not yet contain another child with the same AbstractID
identifying the actual task or the co-location constraint.
Normal slot sharing is represented by a root SlotSharingManager.MultiTaskSlot
which contains a set of
SlotSharingManager.SingleTaskSlot
on the second layer. Each SlotSharingManager.SingleTaskSlot
represents a different
task.
Co-location constraints are modeled by adding a SlotSharingManager.MultiTaskSlot
to the root node. The
co-location constraint is uniquely identified by a AbstractID
such that we cannot add a
second co-located SlotSharingManager.MultiTaskSlot
to the same root node. Now all co-located tasks will be
added to co-located multi task slot.
Modifier and Type | Class and Description |
---|---|
class |
SlotSharingManager.MultiTaskSlot
SlotSharingManager.TaskSlot implementation which can have multiple other task slots assigned as
children. |
class |
SlotSharingManager.SingleTaskSlot
SlotSharingManager.TaskSlot implementation which harbours a LogicalSlot . |
static class |
SlotSharingManager.TaskSlot
Base class for all task slots.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(SlotRequestId slotRequestId) |
SlotSharingManager.MultiTaskSlot |
getResolvedRootSlot(SlotInfo slotInfo) |
Collection<SlotSharingManager.MultiTaskSlot> |
getResolvedRootSlots()
Returns a collection of all resolved root slots.
|
boolean |
isEmpty() |
Collection<SlotSelectionStrategy.SlotInfoAndResources> |
listResolvedRootSlotInfo(AbstractID groupId) |
String |
toString() |
public boolean isEmpty()
public boolean contains(SlotRequestId slotRequestId)
@Nonnull public Collection<SlotSelectionStrategy.SlotInfoAndResources> listResolvedRootSlotInfo(@Nullable AbstractID groupId)
@Nullable public SlotSharingManager.MultiTaskSlot getResolvedRootSlot(@Nonnull SlotInfo slotInfo)
@VisibleForTesting public Collection<SlotSharingManager.MultiTaskSlot> getResolvedRootSlots()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.