public class SlotPool extends RpcEndpoint<SlotPoolGateway>
All the allocation or the slot offering will be identified by self generated AllocationID, we will use it to eliminate ambiguities. TODO : Make pending requests location preference aware TODO : Make pass location preferences to ResourceManager when sending a slot request
log
Constructor and Description |
---|
SlotPool(RpcService rpcService,
JobID jobId) |
SlotPool(RpcService rpcService,
JobID jobId,
Clock clock,
Time slotRequestTimeout,
Time resourceManagerAllocationTimeout,
Time resourceManagerRequestTimeout) |
Modifier and Type | Method and Description |
---|---|
Future<SimpleSlot> |
allocateSlot(ScheduledUnit task,
ResourceProfile resources,
Iterable<TaskManagerLocation> locationPreferences) |
void |
connectToResourceManager(UUID resourceManagerLeaderId,
ResourceManagerGateway resourceManagerGateway) |
void |
disconnectResourceManager() |
void |
failAllocation(AllocationID allocationID,
Exception cause)
Fail the specified allocation and release the corresponding slot if we have one.
|
SlotOwner |
getSlotOwner()
Gets the slot owner implementation for this pool.
|
SlotProvider |
getSlotProvider()
Gets the slot provider implementation for this pool.
|
boolean |
offerSlot(AllocatedSlot slot)
Slot offering by TaskManager with AllocationID.
|
Iterable<SlotOffer> |
offerSlots(Iterable<Tuple2<AllocatedSlot,SlotOffer>> offers) |
void |
registerTaskManager(ResourceID resourceID)
Register TaskManager to this pool, only those slots come from registered TaskManager will be considered valid.
|
void |
releaseTaskManager(ResourceID resourceID)
Unregister TaskManager from this pool, all the related slots will be released and tasks be canceled.
|
void |
returnAllocatedSlot(Slot slot) |
void |
start()
Starts the rpc endpoint.
|
void |
start(UUID newJobManagerLeaderId,
String newJobManagerAddress)
Start the slot pool to accept RPC calls.
|
void |
suspend()
Suspends this pool, meaning it has lost its authority to accept and distribute slots.
|
callAsync, getAddress, getEndpointId, getMainThreadExecutor, getRpcService, getSelf, getSelfGatewayType, getTerminationFuture, runAsync, scheduleRunAsync, scheduleRunAsync, shutDown, validateRunsInMainThread
public SlotPool(RpcService rpcService, JobID jobId)
public void start()
RpcEndpoint
start
in class RpcEndpoint<SlotPoolGateway>
public void start(UUID newJobManagerLeaderId, String newJobManagerAddress) throws Exception
newJobManagerLeaderId
- The necessary leader id for running the job.newJobManagerAddress
- for the slot requests which are sent to the resource managerException
public void suspend()
public SlotOwner getSlotOwner()
This method does not mutate state and can be called directly (no RPC indirection)
public SlotProvider getSlotProvider()
This method does not mutate state and can be called directly (no RPC indirection)
public void connectToResourceManager(UUID resourceManagerLeaderId, ResourceManagerGateway resourceManagerGateway)
public void disconnectResourceManager()
public Future<SimpleSlot> allocateSlot(ScheduledUnit task, ResourceProfile resources, Iterable<TaskManagerLocation> locationPreferences)
public void returnAllocatedSlot(Slot slot)
public boolean offerSlot(AllocatedSlot slot)
slot
- The offered slotpublic void failAllocation(AllocationID allocationID, Exception cause)
allocationID
- Represents the allocation which should be failedcause
- The cause of the failurepublic void registerTaskManager(ResourceID resourceID)
resourceID
- The id of the TaskManagerpublic void releaseTaskManager(ResourceID resourceID)
resourceID
- The id of the TaskManagerCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.