public class KubernetesResourceManager extends ActiveResourceManager<KubernetesWorkerNode> implements FlinkKubeClient.PodCallbackHandler
ResourceManager
.RpcEndpoint.MainThreadExecutor
defaultMemoryMB, env, flinkClientConfig, flinkConfig, numSlotsPerTaskManager, resourceProfilesPerWorker, taskExecutorProcessSpec
RESOURCE_MANAGER_NAME
log, rpcServer
Constructor and Description |
---|
KubernetesResourceManager(RpcService rpcService,
String resourceManagerEndpointId,
ResourceID resourceId,
Configuration flinkConfig,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
SlotManager slotManager,
JobLeaderIdService jobLeaderIdService,
ClusterInformation clusterInformation,
FatalErrorHandler fatalErrorHandler,
ResourceManagerMetricGroup resourceManagerMetricGroup,
FlinkKubeClient kubeClient,
KubernetesResourceManagerConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
protected double |
getCpuCores(Configuration configuration) |
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() . |
Collection<ResourceProfile> |
startNewWorker(ResourceProfile resourceProfile)
Allocates a resource using the resource profile.
|
boolean |
stopWorker(KubernetesWorkerNode worker)
Stops the given worker.
|
protected KubernetesWorkerNode |
workerStarted(ResourceID resourceID)
Callback when a worker was started.
|
getStopTerminationFutureOrCompletedExceptionally
cancelSlotRequest, clearStateAsync, closeJobManagerConnection, closeTaskManagerConnection, deregisterApplication, disconnectJobManager, disconnectTaskManager, getNumberOfRegisteredTaskManagers, getNumberRequiredTaskManagerSlots, grantLeadership, handleError, heartbeatFromJobManager, heartbeatFromTaskManager, jobLeaderLostLeadership, notifySlotAvailable, onFatalError, onStart, prepareLeadershipAsync, registerJobManager, registerTaskExecutor, releaseResource, removeJob, requestResourceOverview, requestSlot, requestTaskManagerFileUpload, requestTaskManagerInfo, requestTaskManagerInfo, requestTaskManagerMetricQueryServiceAddresses, 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, String resourceManagerEndpointId, ResourceID resourceId, Configuration flinkConfig, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, 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 Collection<ResourceProfile> startNewWorker(ResourceProfile resourceProfile)
ResourceManager
startNewWorker
in class ResourceManager<KubernetesWorkerNode>
resourceProfile
- The resource descriptionResourceProfile
describing the launched slotsprotected 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
protected double getCpuCores(Configuration configuration)
getCpuCores
in class ActiveResourceManager<KubernetesWorkerNode>
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.