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 |
Modifier | Constructor and Description |
---|---|
protected |
Slot(AllocatedSlot allocatedSlot,
SlotOwner owner,
int slotNumber,
SharedSlot parent,
AbstractID groupID)
Base constructor for slots.
|
protected |
Slot(JobID jobID,
SlotOwner owner,
TaskManagerLocation location,
int slotNumber,
TaskManagerGateway taskManagerGateway,
SharedSlot parent,
AbstractID groupID)
Base constructor for slots.
|
Modifier and Type | Method and Description |
---|---|
AllocatedSlot |
getAllocatedSlot()
Gets the allocated slot that this slot refers to.
|
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.
|
JobID |
getJobID()
Returns the ID of the job this allocated slot belongs to.
|
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.
|
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.
|
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 void |
releaseSlot()
This method cancels and releases the slot and all its sub-slots.
|
String |
toString() |
protected static final AllocationID NO_ALLOCATION_ID
protected Slot(JobID jobID, SlotOwner owner, TaskManagerLocation location, int slotNumber, TaskManagerGateway taskManagerGateway, @Nullable SharedSlot parent, @Nullable AbstractID groupID)
This is the old way of constructing slots, prior to the FLIP-6 resource management refactoring.
jobID
- The ID of the job that this slot is allocated for.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(AllocatedSlot allocatedSlot, SlotOwner owner, int slotNumber, @Nullable SharedSlot parent, @Nullable AbstractID groupID)
allocatedSlot
- The allocated slot that this slot represents.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 AllocatedSlot getAllocatedSlot()
public JobID getJobID()
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 void releaseSlot()
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.protected String hierarchy()
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.