public class DeclarativeSlotPoolService extends Object implements SlotPoolService
SlotPoolService implementation for the DeclarativeSlotPool.| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
| Constructor and Description |
|---|
DeclarativeSlotPoolService(org.apache.flink.api.common.JobID jobId,
DeclarativeSlotPoolFactory declarativeSlotPoolFactory,
org.apache.flink.util.clock.Clock clock,
org.apache.flink.api.common.time.Time idleSlotTimeout,
org.apache.flink.api.common.time.Time rpcTimeout) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertHasBeenStarted() |
<T> Optional<T> |
castInto(Class<T> clazz)
Tries to cast this slot pool service into the given clazz.
|
void |
close()
Close the slot pool service.
|
void |
connectToResourceManager(ResourceManagerGateway resourceManagerGateway)
Connects the SlotPool to the given ResourceManager.
|
AllocatedSlotReport |
createAllocatedSlotReport(ResourceID taskManagerId)
Create report about the allocated slots belonging to the specified task manager.
|
void |
disconnectResourceManager()
Disconnects the slot pool from its current Resource Manager.
|
Optional<ResourceID> |
failAllocation(ResourceID taskManagerId,
AllocationID allocationId,
Exception cause)
Fails the allocation with the given allocationId.
|
protected DeclarativeSlotPool |
getDeclarativeSlotPool() |
protected long |
getRelativeTimeMillis() |
protected String |
getSlotServiceStatus() |
Collection<SlotOffer> |
offerSlots(TaskManagerLocation taskManagerLocation,
TaskManagerGateway taskManagerGateway,
Collection<SlotOffer> offers)
Offers multiple slots to the
SlotPoolService. |
protected void |
onClose()
This method is called when the slot pool service is closed.
|
protected void |
onFailAllocation(ResourceCounter previouslyFulfilledRequirements)
This method is called when an allocation fails.
|
protected void |
onReleaseTaskManager(ResourceCounter previouslyFulfilledRequirement)
This method is called when a TaskManager is released.
|
protected void |
onStart(org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor componentMainThreadExecutor)
This method is called when the slot pool service is started.
|
boolean |
registerTaskManager(ResourceID taskManagerId)
Registers a TaskExecutor with the given
ResourceID at SlotPoolService. |
void |
releaseFreeSlotsOnTaskManager(ResourceID taskManagerId,
Exception cause)
Releases all free slots belonging to the owning TaskExecutor if it has been registered.
|
boolean |
releaseTaskManager(ResourceID taskManagerId,
Exception cause)
Releases a TaskExecutor with the given
ResourceID from the SlotPoolService. |
void |
start(JobMasterId jobMasterId,
String address,
org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor mainThreadExecutor)
Start the encapsulated slot pool implementation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnotifyNotEnoughResourcesAvailablepublic DeclarativeSlotPoolService(org.apache.flink.api.common.JobID jobId,
DeclarativeSlotPoolFactory declarativeSlotPoolFactory,
org.apache.flink.util.clock.Clock clock,
org.apache.flink.api.common.time.Time idleSlotTimeout,
org.apache.flink.api.common.time.Time rpcTimeout)
protected DeclarativeSlotPool getDeclarativeSlotPool()
protected long getRelativeTimeMillis()
public <T> Optional<T> castInto(Class<T> clazz)
SlotPoolServicecastInto in interface SlotPoolServiceT - type of clazzclazz - to cast the slot pool service intoOptional.of(T) the target type if it can be cast; otherwise Optional.empty()public final void start(JobMasterId jobMasterId, String address, org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor mainThreadExecutor) throws Exception
SlotPoolServicestart in interface SlotPoolServicejobMasterId - jobMasterId to start the service withaddress - address of the ownermainThreadExecutor - mainThreadExecutor to run actions in the main threadException - if the service cannot be startedprotected void onStart(org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor componentMainThreadExecutor)
componentMainThreadExecutor - componentMainThreadExecutor used by this slot pool serviceprotected void assertHasBeenStarted()
public final void close()
SlotPoolServiceclose in interface AutoCloseableclose in interface SlotPoolServiceprotected void onClose()
public Collection<SlotOffer> offerSlots(TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, Collection<SlotOffer> offers)
SlotPoolServiceSlotPoolService. The slot offerings can be individually
accepted or rejected by returning the collection of accepted slot offers.offerSlots in interface SlotPoolServicetaskManagerLocation - from which the slot offers originatetaskManagerGateway - to talk to the slot offereroffers - slot offers which are offered to the SlotPoolServicepublic Optional<ResourceID> failAllocation(@Nullable ResourceID taskManagerId, AllocationID allocationId, Exception cause)
SlotPoolServicefailAllocation in interface SlotPoolServicetaskManagerId - taskManagerId is non-null if the signal comes from a TaskManager; if the
signal comes from the ResourceManager, then it is nullallocationId - allocationId identifies which allocation to failcause - cause why the allocation failedprotected void onFailAllocation(ResourceCounter previouslyFulfilledRequirements)
previouslyFulfilledRequirements - previouslyFulfilledRequirements by the failed
allocationpublic boolean registerTaskManager(ResourceID taskManagerId)
SlotPoolServiceResourceID at SlotPoolService.registerTaskManager in interface SlotPoolServicetaskManagerId - identifying the TaskExecutor to registerpublic boolean releaseTaskManager(ResourceID taskManagerId, Exception cause)
SlotPoolServiceResourceID from the SlotPoolService.releaseTaskManager in interface SlotPoolServicetaskManagerId - identifying the TaskExecutor which shall be released from the SlotPoolcause - for the releasing of the TaskManagerpublic void releaseFreeSlotsOnTaskManager(ResourceID taskManagerId, Exception cause)
SlotPoolServicereleaseFreeSlotsOnTaskManager in interface SlotPoolServicetaskManagerId - identifying the TaskExecutorcause - cause for failing the slotsprotected void onReleaseTaskManager(ResourceCounter previouslyFulfilledRequirement)
previouslyFulfilledRequirement - previouslyFulfilledRequirement by the released
TaskManagerpublic void connectToResourceManager(ResourceManagerGateway resourceManagerGateway)
SlotPoolServiceconnectToResourceManager in interface SlotPoolServiceresourceManagerGateway - The RPC gateway for the resource manager.public void disconnectResourceManager()
SlotPoolServiceThe slot pool will still be able to serve slots from its internal pool.
disconnectResourceManager in interface SlotPoolServicepublic AllocatedSlotReport createAllocatedSlotReport(ResourceID taskManagerId)
SlotPoolServicecreateAllocatedSlotReport in interface SlotPoolServicetaskManagerId - identifies the task managerprotected String getSlotServiceStatus()
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.