public class SlotSharingGroupAssignment extends Object
SlotSharingGroup
.
The assignments shares tasks by allowing a shared slot to hold one vertex per
JobVertexID. For example, consider a program consisting of job vertices "source", "map",
"reduce", and "sink". If the slot sharing group spans all four job vertices, then
each shared slot can hold one parallel subtask of the source, the map, the reduce, and the
sink vertex. Each shared slot holds the actual subtasks in child slots, which are (at the leaf level),
the SimpleSlot
s.
An exception are the co-location-constraints, that define that the i-th subtask of one vertex needs to be scheduled strictly together with the i-th subtasks of the vertices that share the co-location-constraint. To manage that, a co-location-constraint gets its own shared slot inside the shared slots of a sharing group.
Consider a job set up like this:
+-------------- Slot Sharing Group --------------+
| |
| +-- Co Location Group --+ |
| | | |
| (source) ---> (head) ---> (tail) ---> (sink) |
| | | |
| +-----------------------+ |
+------------------------------------------------+
The slot hierarchy in the slot sharing group will look like the following
Shared(0)(root) | +-- Simple(2)(sink) | +-- Shared(1)(co-location-group) | | | +-- Simple(0)(tail) | +-- Simple(1)(head) | +-- Simple(0)(source)
Constructor and Description |
---|
SlotSharingGroupAssignment() |
Modifier and Type | Method and Description |
---|---|
SimpleSlot |
addSharedSlotAndAllocateSubSlot(SharedSlot sharedSlot,
Locality locality,
CoLocationConstraint constraint) |
SimpleSlot |
addSharedSlotAndAllocateSubSlot(SharedSlot sharedSlot,
Locality locality,
JobVertexID groupId) |
int |
getNumberOfAvailableSlotsForGroup(AbstractID groupId)
Gets the number of shared slots into which the given group can place subtasks or
nested task groups.
|
int |
getNumberOfSlots()
Gets the number of slots that are currently governed by this assignment group.
|
Tuple2<SharedSlot,Locality> |
getSharedSlotForTask(AbstractID groupId,
Iterable<TaskManagerLocation> preferredLocations,
boolean localOnly) |
SimpleSlot |
getSlotForTask(CoLocationConstraint constraint,
Iterable<TaskManagerLocation> locationPreferences)
Gets a slot for a task that has a co-location constraint.
|
SimpleSlot |
getSlotForTask(JobVertexID vertexID,
Iterable<TaskManagerLocation> locationPreferences)
Gets a slot suitable for the given task vertex.
|
public int getNumberOfSlots()
Instance
,
and not the sub-slots given out as children of those shared slots.public int getNumberOfAvailableSlotsForGroup(AbstractID groupId)
groupId
- The ID of the group.public SimpleSlot addSharedSlotAndAllocateSubSlot(SharedSlot sharedSlot, Locality locality, JobVertexID groupId)
public SimpleSlot addSharedSlotAndAllocateSubSlot(SharedSlot sharedSlot, Locality locality, CoLocationConstraint constraint)
public SimpleSlot getSlotForTask(JobVertexID vertexID, Iterable<TaskManagerLocation> locationPreferences)
ExecutionVertex.getPreferredLocationsBasedOnInputs()
), but will return non local
slots if no local slot is available. The method returns null, when this sharing group has
no slot is available for the given JobVertexID.vertexID
- the vertex idlocationPreferences
- location preferencespublic SimpleSlot getSlotForTask(CoLocationConstraint constraint, Iterable<TaskManagerLocation> locationPreferences)
In cases where the co-location constraint has not yet been initialized with a slot, or where that slot has been disposed in the meantime, this method tries to allocate a shared slot for the co-location constraint (inside on of the other available slots).
If a suitable shared slot is available, this method allocates a simple slot within that shared slot and returns it. If no suitable shared slot could be found, this method returns null.
constraint
- The co-location constraint for the placement of the execution vertex.locationPreferences
- location preferencesnull
, if no suitable
shared slot is available.public Tuple2<SharedSlot,Locality> getSharedSlotForTask(AbstractID groupId, Iterable<TaskManagerLocation> preferredLocations, boolean localOnly)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.