public abstract class Slot extends Object
In the simplest case, a slot holds a single task (SimpleSlot
). In the more complex
case, a slot is shared (SharedSlot
) and contains a set of tasks. Shared slots may contain
other shared slots which in turn can hold simple slots. That way, a shared slot may define a tree
of slots that belong to it.
Modifier and Type | Field and Description |
---|---|
protected static AllocationID |
NO_ALLOCATION_ID |
protected static SlotRequestId |
NO_SLOT_REQUEST_ID |
protected static SlotSharingGroupId |
NO_SLOT_SHARING_GROUP_ID |
Modifier | Constructor and Description |
---|---|
protected |
Slot(SlotContext slotContext,
SlotOwner owner,
int slotNumber,
SharedSlot parent,
AbstractID groupID)
Base constructor for slots.
|
protected |
Slot(SlotOwner owner,
TaskManagerLocation location,
int slotNumber,
TaskManagerGateway taskManagerGateway,
SharedSlot parent,
AbstractID groupID)
Base constructor for slots.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Slots must always compare on referential equality.
|
AbstractID |
getGroupID()
Gets the ID that identifies the logical group to which this slot belongs:
If the slot does not belong to any group in particular, this field is null.
If this slot was allocated as a sub-slot of a
SlotSharingGroupAssignment ,
then this ID will be the JobVertexID of the vertex whose task the slot
holds in its shared slot.
In case that the slot represents the shared slot of a co-location constraint, this ID will be the
ID of the co-location constraint.
|
abstract int |
getNumberLeaves()
Gets the number of simple slots that are at the leaves of the tree of slots.
|
SlotOwner |
getOwner()
Gets the owner of this slot.
|
SharedSlot |
getParent()
Gets the parent slot of this slot.
|
Slot |
getRoot()
Gets the root slot of the tree containing this slot.
|
int |
getRootSlotNumber()
Gets the number of the root slot.
|
SlotContext |
getSlotContext()
Gets the allocated slot that this slot refers to.
|
int |
getSlotNumber()
Gets the number of the slot.
|
TaskManagerGateway |
getTaskManagerGateway()
Gets the actor gateway that can be used to send messages to the TaskManager.
|
ResourceID |
getTaskManagerID()
Gets the ID of the TaskManager that offers this slot.
|
TaskManagerLocation |
getTaskManagerLocation()
Gets the location info of the TaskManager that offers this slot.
|
int |
hashCode()
Slots must always has based on reference identity.
|
protected String |
hierarchy() |
boolean |
isAlive()
Checks of the slot is still alive, i.e.
|
boolean |
isCanceled()
Checks of the slot has been cancelled.
|
boolean |
isReleased()
Checks of the slot has been released.
|
abstract CompletableFuture<?> |
releaseSlot(Throwable cause)
This method cancels and releases the slot and all its sub-slots.
|
String |
toString() |
protected static final AllocationID NO_ALLOCATION_ID
protected static final SlotRequestId NO_SLOT_REQUEST_ID
protected static final SlotSharingGroupId NO_SLOT_SHARING_GROUP_ID
protected Slot(SlotOwner owner, TaskManagerLocation location, int slotNumber, TaskManagerGateway taskManagerGateway, @Nullable SharedSlot parent, @Nullable AbstractID groupID)
This is the old way of constructing slots by the legacy code
owner
- The component from which this slot is allocated.location
- The location info of the TaskManager where the slot was allocated fromslotNumber
- The number of this slot.taskManagerGateway
- The actor gateway to communicate with the TaskManagerparent
- The parent slot that contains this slot. May be null, if this slot is the root.groupID
- The ID that identifies the task group for which this slot is allocated. May be null
if the slot does not belong to any task group.protected Slot(SlotContext slotContext, SlotOwner owner, int slotNumber, @Nullable SharedSlot parent, @Nullable AbstractID groupID)
slotContext
- The slot context of this slot.owner
- The component from which this slot is allocated.slotNumber
- The number of this slot.parent
- The parent slot that contains this slot. May be null, if this slot is the root.groupID
- The ID that identifies the task group for which this slot is allocated. May be null
if the slot does not belong to any task group.public SlotContext getSlotContext()
public ResourceID getTaskManagerID()
public TaskManagerLocation getTaskManagerLocation()
public TaskManagerGateway getTaskManagerGateway()
This method should be removed once the new interface-based RPC abstraction is in place
public SlotOwner getOwner()
public int getSlotNumber()
public int getRootSlotNumber()
getRoot().getSlotNumber()
.
If this slot is the root of the tree of shared slots, then this method returns the same
value as getSlotNumber()
.@Nullable public AbstractID getGroupID()
SlotSharingGroupAssignment
,
then this ID will be the JobVertexID of the vertex whose task the slot
holds in its shared slot.@Nullable public SharedSlot getParent()
public Slot getRoot()
public abstract int getNumberLeaves()
public boolean isAlive()
ALLOCATED_AND_ALIVE
.public boolean isCanceled()
public boolean isReleased()
public abstract CompletableFuture<?> releaseSlot(@Nullable Throwable cause)
isReleased()
method will return true
.
If this slot is a simple slot, it will be returned to its instance. If it is a shared slot,
it will release all of its sub-slots and release itself.public final int hashCode()
public final boolean equals(Object obj)
protected String hierarchy()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.