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 | Constructor and Description |
---|---|
protected |
Slot(JobID jobID,
Instance instance,
int slotNumber,
SharedSlot parent,
AbstractID groupID)
Base constructor for slots.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Instance |
getInstance()
Gets the instance from which the slot was allocated.
|
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.
|
SharedSlot |
getParent()
Gets the parent slot of this slot.
|
Slot |
getRoot() |
int |
getRootSlotNumber()
Gets the number of the root slot.
|
int |
getSlotNumber()
Gets the number of the 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 Slot(JobID jobID, Instance instance, int slotNumber, SharedSlot parent, AbstractID groupID)
jobID
- The ID of the job that this slot is allocated for.instance
- The instance 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 JobID getJobID()
public Instance getInstance()
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()
.public AbstractID getGroupID()
SlotSharingGroupAssignment
,
then this ID will be the JobVertexID of the vertex whose task the slot
holds in its shared slot.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.