public class ActiveResourceManager<WorkerType extends ResourceIDRetrievable> extends ResourceManager<WorkerType> implements ResourceEventHandler<WorkerType>
ResourceManager.
This resource manager actively requests and releases resources from/to the external resource
management frameworks. With different ResourceManagerDriver provided, this resource
manager can work with various frameworks.
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.flink.configuration.Configuration |
flinkConfig |
ioExecutor, RESOURCE_MANAGER_NAME, resourceManagerMetricGroup| Constructor and Description |
|---|
ActiveResourceManager(ResourceManagerDriver<WorkerType> resourceManagerDriver,
org.apache.flink.configuration.Configuration flinkConfig,
org.apache.flink.runtime.rpc.RpcService rpcService,
UUID leaderSessionId,
ResourceID resourceId,
HeartbeatServices heartbeatServices,
SlotManager slotManager,
ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory,
JobLeaderIdService jobLeaderIdService,
ClusterInformation clusterInformation,
org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler,
ResourceManagerMetricGroup resourceManagerMetricGroup,
ThresholdMeter startWorkerFailureRater,
java.time.Duration retryInterval,
java.time.Duration workerRegistrationTimeout,
Executor ioExecutor) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
initialize()
Initializes the framework specific components.
|
protected void |
internalDeregisterApplication(ApplicationStatus finalStatus,
String optionalDiagnostics)
The framework specific code to deregister the application.
|
void |
onError(Throwable exception)
Notifies that an error has occurred that the process cannot proceed.
|
void |
onPreviousAttemptWorkersRecovered(Collection<WorkerType> recoveredWorkers)
Notifies that workers of previous attempt have been recovered from the external resource
manager.
|
protected void |
onWorkerRegistered(WorkerType worker) |
void |
onWorkerTerminated(ResourceID resourceId,
String diagnostics)
Notifies that the worker has been terminated.
|
protected void |
registerMetrics() |
boolean |
startNewWorker(WorkerResourceSpec workerResourceSpec)
Allocates a resource using the worker resource specification.
|
boolean |
stopWorker(WorkerType worker)
Stops the given worker.
|
protected void |
terminate()
Terminates the framework specific components.
|
protected WorkerType |
workerStarted(ResourceID resourceID)
Callback when a worker was started.
|
closeJobManagerConnection, closeTaskManagerConnection, declareRequiredResources, deregisterApplication, disconnectJobManager, disconnectTaskManager, getNumberOfRegisteredTaskManagers, getRequiredResources, getStartedFuture, heartbeatFromJobManager, heartbeatFromTaskManager, jobLeaderLostLeadership, listDataSets, notifySlotAvailable, onFatalError, onStart, onStop, registerJobMaster, registerTaskExecutor, releaseClusterPartitions, releaseResource, removeJob, requestResourceOverview, requestTaskExecutorThreadInfoGateway, requestTaskManagerDetailsInfo, requestTaskManagerFileUploadByName, requestTaskManagerFileUploadByType, requestTaskManagerInfo, requestTaskManagerLogList, requestTaskManagerMetricQueryServiceAddresses, requestThreadDump, sendSlotReport, setFailUnfulfillableRequestcallAsyncWithoutFencing, getFencingToken, getMainThreadExecutor, getUnfencedMainThreadExecutor, runAsyncWithoutFencing, setFencingTokencallAsync, closeAsync, getAddress, getEndpointId, getHostname, getRpcService, getSelfGateway, getTerminationFuture, internalCallOnStart, internalCallOnStop, isRunning, runAsync, scheduleRunAsync, scheduleRunAsync, start, stop, validateRunsInMainThreadpublic ActiveResourceManager(ResourceManagerDriver<WorkerType> resourceManagerDriver, org.apache.flink.configuration.Configuration flinkConfig, org.apache.flink.runtime.rpc.RpcService rpcService, UUID leaderSessionId, ResourceID resourceId, HeartbeatServices heartbeatServices, SlotManager slotManager, ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler, ResourceManagerMetricGroup resourceManagerMetricGroup, ThresholdMeter startWorkerFailureRater, java.time.Duration retryInterval, java.time.Duration workerRegistrationTimeout, Executor ioExecutor)
protected void initialize()
throws ResourceManagerException
ResourceManagerinitialize in class ResourceManager<WorkerType extends ResourceIDRetrievable>ResourceManagerException - which occurs during initialization and causes the resource
manager to fail.protected void terminate()
throws ResourceManagerException
ResourceManagerterminate in class ResourceManager<WorkerType extends ResourceIDRetrievable>ResourceManagerExceptionprotected void internalDeregisterApplication(ApplicationStatus finalStatus, @Nullable String optionalDiagnostics) throws ResourceManagerException
ResourceManagerThis method also needs to make sure all pending containers that are not registered yet are returned.
internalDeregisterApplication in class ResourceManager<WorkerType extends ResourceIDRetrievable>finalStatus - The application status to report.optionalDiagnostics - A diagnostics message or null.ResourceManagerException - if the application could not be shut down.public boolean startNewWorker(WorkerResourceSpec workerResourceSpec)
ResourceManagerstartNewWorker in class ResourceManager<WorkerType extends ResourceIDRetrievable>workerResourceSpec - workerResourceSpec specifies the size of the to be allocated
resourceprotected WorkerType workerStarted(ResourceID resourceID)
ResourceManagerworkerStarted in class ResourceManager<WorkerType extends ResourceIDRetrievable>resourceID - The worker resource idpublic boolean stopWorker(WorkerType worker)
ResourceManagerstopWorker in class ResourceManager<WorkerType extends ResourceIDRetrievable>worker - The worker.protected void onWorkerRegistered(WorkerType worker)
onWorkerRegistered in class ResourceManager<WorkerType extends ResourceIDRetrievable>protected void registerMetrics()
registerMetrics in class ResourceManager<WorkerType extends ResourceIDRetrievable>public void onPreviousAttemptWorkersRecovered(Collection<WorkerType> recoveredWorkers)
ResourceEventHandleronPreviousAttemptWorkersRecovered in interface ResourceEventHandler<WorkerType extends ResourceIDRetrievable>recoveredWorkers - Collection of worker nodes, in the deployment specific type.public void onWorkerTerminated(ResourceID resourceId, String diagnostics)
ResourceEventHandleronWorkerTerminated in interface ResourceEventHandler<WorkerType extends ResourceIDRetrievable>resourceId - Identifier of the terminated worker.diagnostics - Diagnostic message about the worker termination.public void onError(Throwable exception)
ResourceEventHandleronError in interface ResourceEventHandler<WorkerType extends ResourceIDRetrievable>exception - Exception that describes the error.Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.