public class SharedSlot extends Slot
SimpleSlot
instances within itself. This allows to
schedule multiple tasks simultaneously to the same resource. Sharing a resource with multiple
tasks is crucial for simple pipelined / streamed execution, where both the sender and the receiver
are typically active at the same time.
IMPORTANT: This class contains no synchronization. Thus, the caller has to guarantee proper
synchronization. In the current implementation, all concurrently modifying operations are
passed through a SlotSharingGroupAssignment
object which is responsible for
synchronization.
NO_ALLOCATION_ID
Constructor and Description |
---|
SharedSlot(AllocatedSlot allocatedSlot,
SlotOwner owner,
SlotSharingGroupAssignment assignmentGroup)
Creates a new shared slot that has no parent (is a root slot) and does not belong to any task group.
|
SharedSlot(JobID jobID,
SlotOwner owner,
TaskManagerLocation location,
int slotNumber,
TaskManagerGateway taskManagerGateway,
SlotSharingGroupAssignment assignmentGroup)
Creates a new shared slot that has no parent (is a root slot) and does not belong to any task group.
|
SharedSlot(JobID jobID,
SlotOwner owner,
TaskManagerLocation location,
int slotNumber,
TaskManagerGateway taskManagerGateway,
SlotSharingGroupAssignment assignmentGroup,
SharedSlot parent,
AbstractID groupId)
Creates a new shared slot that has is a sub-slot of the given parent shared slot, and that belongs
to the given task group.
|
SharedSlot(SharedSlot parent,
SlotOwner owner,
int slotNumber,
SlotSharingGroupAssignment assignmentGroup,
AbstractID groupId)
Creates a new shared slot that is a sub-slot of the given parent shared slot, and that belongs
to the given task group.
|
Modifier and Type | Method and Description |
---|---|
int |
getNumberLeaves()
Gets the number of simple slots that are at the leaves of the tree of slots.
|
boolean |
hasChildren()
Checks whether this shared slot has any sub slots.
|
boolean |
isRootAndEmpty()
Checks whether this slot is a root slot that has not yet added any child slots.
|
void |
releaseSlot()
This method cancels and releases the slot and all its sub-slots.
|
String |
toString() |
equals, getAllocatedSlot, getGroupID, getJobID, getOwner, getParent, getRoot, getRootSlotNumber, getSlotNumber, getTaskManagerGateway, getTaskManagerID, getTaskManagerLocation, hashCode, hierarchy, isAlive, isCanceled, isReleased
public SharedSlot(JobID jobID, SlotOwner owner, TaskManagerLocation location, int slotNumber, TaskManagerGateway taskManagerGateway, SlotSharingGroupAssignment assignmentGroup)
jobID
- The ID of the job that the slot is created 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 the slot.taskManagerGateway
- The gateway to communicate with the TaskManagerassignmentGroup
- The assignment group that this shared slot belongs to.public SharedSlot(JobID jobID, SlotOwner owner, TaskManagerLocation location, int slotNumber, TaskManagerGateway taskManagerGateway, SlotSharingGroupAssignment assignmentGroup, @Nullable SharedSlot parent, @Nullable AbstractID groupId)
jobID
- The ID of the job that the slot is created 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 the slot.taskManagerGateway
- The gateway to communicate with the TaskManagerassignmentGroup
- The assignment group that this shared slot belongs to.parent
- The parent slot of this slot.groupId
- The assignment group of this slot.public SharedSlot(AllocatedSlot allocatedSlot, SlotOwner owner, SlotSharingGroupAssignment assignmentGroup)
allocatedSlot
- The allocated slot that this slot represents.owner
- The component from which this slot is allocated.assignmentGroup
- The assignment group that this shared slot belongs to.public SharedSlot(SharedSlot parent, SlotOwner owner, int slotNumber, SlotSharingGroupAssignment assignmentGroup, AbstractID groupId)
parent
- The parent slot of this slot.owner
- The component from which this slot is allocated.slotNumber
- The number of the slot.assignmentGroup
- The assignment group that this shared slot belongs to.groupId
- The assignment group of this slot.public int getNumberLeaves()
Slot
getNumberLeaves
in class Slot
public boolean isRootAndEmpty()
public boolean hasChildren()
public void releaseSlot()
Slot
Slot.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.releaseSlot
in class Slot
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.