public class KubernetesResourceManager extends ActiveResourceManager<KubernetesWorkerNode> implements FlinkKubeClient.PodCallbackHandler
ResourceManager
.ActiveResourceManager.PendingWorkerNums
RpcEndpoint.MainThreadExecutor
env, flinkClientConfig, flinkConfig
RESOURCE_MANAGER_NAME
log, rpcServer
Constructor and Description |
---|
KubernetesResourceManager(RpcService rpcService,
ResourceID resourceId,
Configuration flinkConfig,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
SlotManager slotManager,
ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory,
JobLeaderIdService jobLeaderIdService,
ClusterInformation clusterInformation,
FatalErrorHandler fatalErrorHandler,
ResourceManagerMetricGroup resourceManagerMetricGroup,
FlinkKubeClient kubeClient,
KubernetesResourceManagerConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
handleFatalError(Throwable throwable) |
protected void |
initialize()
Initializes the framework specific components.
|
protected void |
internalDeregisterApplication(ApplicationStatus finalStatus,
String diagnostics)
The framework specific code to deregister the application.
|
protected Configuration |
loadClientConfiguration() |
void |
onAdded(List<KubernetesPod> pods) |
void |
onDeleted(List<KubernetesPod> pods) |
void |
onError(List<KubernetesPod> pods) |
void |
onModified(List<KubernetesPod> pods) |
CompletableFuture<Void> |
onStop()
User overridable callback which is called from
RpcEndpoint.internalCallOnStop() . |
boolean |
startNewWorker(WorkerResourceSpec workerResourceSpec)
Allocates a resource using the worker resource specification.
|
boolean |
stopWorker(KubernetesWorkerNode worker)
Stops the given worker.
|
protected KubernetesWorkerNode |
workerStarted(ResourceID resourceID)
Callback when a worker was started.
|
getNumRequestedNotAllocatedWorkers, getNumRequestedNotAllocatedWorkersFor, getNumRequestedNotRegisteredWorkers, getNumRequestedNotRegisteredWorkersFor, getStopTerminationFutureOrCompletedExceptionally, notifyAllocatedWorkerStopped, notifyNewWorkerAllocated, notifyNewWorkerAllocationFailed, notifyNewWorkerRequested, onTaskManagerRegistration
cancelSlotRequest, clearStateAsync, closeJobManagerConnection, closeTaskManagerConnection, deregisterApplication, disconnectJobManager, disconnectTaskManager, getNumberOfRegisteredTaskManagers, getNumberRequiredTaskManagers, getRequiredResources, grantLeadership, handleError, heartbeatFromJobManager, heartbeatFromTaskManager, jobLeaderLostLeadership, listDataSets, notifySlotAvailable, onFatalError, onStart, prepareLeadershipAsync, registerJobManager, registerTaskExecutor, releaseClusterPartitions, releaseResource, removeJob, requestResourceOverview, requestSlot, requestTaskManagerFileUploadByName, requestTaskManagerFileUploadByType, requestTaskManagerInfo, requestTaskManagerInfo, requestTaskManagerLogList, requestTaskManagerMetricQueryServiceAddresses, requestThreadDump, revokeLeadership, sendSlotReport, setFailUnfulfillableRequest, startServicesOnLeadership
callAsyncWithoutFencing, getFencingToken, getMainThreadExecutor, getUnfencedMainThreadExecutor, runAsyncWithoutFencing, setFencingToken
callAsync, closeAsync, getAddress, getEndpointId, getHostname, getRpcService, getSelfGateway, getTerminationFuture, internalCallOnStart, internalCallOnStop, isRunning, runAsync, scheduleRunAsync, scheduleRunAsync, start, stop, validateRunsInMainThread
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFencingToken
getAddress, getHostname
getDescription
close
public KubernetesResourceManager(RpcService rpcService, ResourceID resourceId, Configuration flinkConfig, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, ResourceManagerMetricGroup resourceManagerMetricGroup, FlinkKubeClient kubeClient, KubernetesResourceManagerConfiguration configuration)
protected Configuration loadClientConfiguration()
loadClientConfiguration
in class ActiveResourceManager<KubernetesWorkerNode>
protected void initialize() throws ResourceManagerException
ResourceManager
initialize
in class ResourceManager<KubernetesWorkerNode>
ResourceManagerException
- which occurs during initialization and causes the resource
manager to fail.public CompletableFuture<Void> onStop()
RpcEndpoint
RpcEndpoint.internalCallOnStop()
.
This method is called when the RpcEndpoint is being shut down. The method is guaranteed to be executed in the main thread context and can be used to clean up internal state.
IMPORTANT: This method should never be called directly by the user.
onStop
in class ResourceManager<KubernetesWorkerNode>
protected void internalDeregisterApplication(ApplicationStatus finalStatus, @Nullable String diagnostics)
ResourceManager
This method also needs to make sure all pending containers that are not registered yet are returned.
internalDeregisterApplication
in class ResourceManager<KubernetesWorkerNode>
finalStatus
- The application status to report.diagnostics
- A diagnostics message or null
.public boolean startNewWorker(WorkerResourceSpec workerResourceSpec)
ResourceManager
startNewWorker
in class ResourceManager<KubernetesWorkerNode>
workerResourceSpec
- workerResourceSpec specifies the size of the to be allocated
resourceprotected KubernetesWorkerNode workerStarted(ResourceID resourceID)
ResourceManager
workerStarted
in class ResourceManager<KubernetesWorkerNode>
resourceID
- The worker resource idpublic boolean stopWorker(KubernetesWorkerNode worker)
ResourceManager
stopWorker
in class ResourceManager<KubernetesWorkerNode>
worker
- The worker.public void onAdded(List<KubernetesPod> pods)
onAdded
in interface FlinkKubeClient.PodCallbackHandler
public void onModified(List<KubernetesPod> pods)
onModified
in interface FlinkKubeClient.PodCallbackHandler
public void onDeleted(List<KubernetesPod> pods)
onDeleted
in interface FlinkKubeClient.PodCallbackHandler
public void onError(List<KubernetesPod> pods)
onError
in interface FlinkKubeClient.PodCallbackHandler
public void handleFatalError(Throwable throwable)
handleFatalError
in interface FlinkKubeClient.PodCallbackHandler
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.