public abstract class Dispatcher extends FencedRpcEndpoint<DispatcherId> implements DispatcherGateway, LeaderContender, SubmittedJobGraphStore.SubmittedJobGraphListener
| Modifier and Type | Class and Description |
|---|---|
static class |
Dispatcher.DefaultJobManagerRunnerFactory
Singleton default factory for
JobManagerRunner. |
static interface |
Dispatcher.JobManagerRunnerFactory
Factory for a
JobManagerRunner. |
RpcEndpoint.MainThreadExecutor| Modifier and Type | Field and Description |
|---|---|
static String |
DISPATCHER_NAME |
protected String |
restAddress |
log, rpcServer| Constructor and Description |
|---|
Dispatcher(RpcService rpcService,
String endpointId,
org.apache.flink.configuration.Configuration configuration,
HighAvailabilityServices highAvailabilityServices,
SubmittedJobGraphStore submittedJobGraphStore,
ResourceManagerGateway resourceManagerGateway,
BlobServer blobServer,
HeartbeatServices heartbeatServices,
JobManagerMetricGroup jobManagerMetricGroup,
String metricServiceQueryPath,
ArchivedExecutionGraphStore archivedExecutionGraphStore,
Dispatcher.JobManagerRunnerFactory jobManagerRunnerFactory,
FatalErrorHandler fatalErrorHandler,
String restAddress,
HistoryServerArchivist historyServerArchivist) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Acknowledge> |
cancelJob(org.apache.flink.api.common.JobID jobId,
org.apache.flink.api.common.time.Time timeout)
Cancel the given job.
|
CompletableFuture<Acknowledge> |
disposeSavepoint(String savepointPath,
org.apache.flink.api.common.time.Time timeout)
Dispose the given savepoint.
|
CompletableFuture<Integer> |
getBlobServerPort(org.apache.flink.api.common.time.Time timeout)
Returns the port of the blob server.
|
void |
grantLeadership(UUID newLeaderSessionID)
Callback method when current resourceManager is granted leadership.
|
void |
handleError(Exception exception)
Handles error occurring in the leader election service.
|
protected void |
jobNotFinished(org.apache.flink.api.common.JobID jobId) |
protected void |
jobReachedGloballyTerminalState(ArchivedExecutionGraph archivedExecutionGraph) |
CompletableFuture<Collection<org.apache.flink.api.common.JobID>> |
listJobs(org.apache.flink.api.common.time.Time timeout)
List the current set of submitted jobs.
|
void |
onAddedJobGraph(org.apache.flink.api.common.JobID jobId)
Callback for
SubmittedJobGraph instances added by a different SubmittedJobGraphStore instance. |
protected void |
onFatalError(Throwable throwable) |
void |
onRemovedJobGraph(org.apache.flink.api.common.JobID jobId)
Callback for
SubmittedJobGraph instances removed by a different SubmittedJobGraphStore instance. |
CompletableFuture<Void> |
postStop()
User overridable callback.
|
CompletableFuture<ClusterOverview> |
requestClusterOverview(org.apache.flink.api.common.time.Time timeout)
Requests the cluster status overview.
|
CompletableFuture<ArchivedExecutionGraph> |
requestJob(org.apache.flink.api.common.JobID jobId,
org.apache.flink.api.common.time.Time timeout)
Requests the
ArchivedExecutionGraph for the given jobId. |
CompletableFuture<JobResult> |
requestJobResult(org.apache.flink.api.common.JobID jobId,
org.apache.flink.api.common.time.Time timeout)
Requests the
JobResult of a job specified by the given jobId. |
CompletableFuture<JobStatus> |
requestJobStatus(org.apache.flink.api.common.JobID jobId,
org.apache.flink.api.common.time.Time timeout)
Request the
JobStatus of the given job. |
CompletableFuture<Collection<String>> |
requestMetricQueryServicePaths(org.apache.flink.api.common.time.Time timeout)
Requests the paths for the
MetricQueryService to query. |
CompletableFuture<MultipleJobsDetails> |
requestMultipleJobDetails(org.apache.flink.api.common.time.Time timeout)
Requests job details currently being executed on the Flink cluster.
|
CompletableFuture<OperatorBackPressureStatsResponse> |
requestOperatorBackPressureStats(org.apache.flink.api.common.JobID jobId,
JobVertexID jobVertexId)
Requests the statistics on operator back pressure.
|
CompletableFuture<String> |
requestRestAddress(org.apache.flink.api.common.time.Time timeout)
Requests the REST address of this
RpcEndpoint. |
CompletableFuture<Collection<org.apache.flink.api.java.tuple.Tuple2<ResourceID,String>>> |
requestTaskManagerMetricQueryServicePaths(org.apache.flink.api.common.time.Time timeout)
Requests the paths for the TaskManager's
MetricQueryService to query. |
CompletableFuture<Acknowledge> |
rescaleJob(org.apache.flink.api.common.JobID jobId,
int newParallelism,
RescalingBehaviour rescalingBehaviour,
org.apache.flink.api.common.time.Time timeout)
Trigger rescaling of the given job.
|
void |
revokeLeadership()
Callback method when current resourceManager loses leadership.
|
CompletableFuture<Acknowledge> |
shutDownCluster() |
void |
start()
Starts the rpc endpoint.
|
CompletableFuture<Acknowledge> |
stopJob(org.apache.flink.api.common.JobID jobId,
org.apache.flink.api.common.time.Time timeout)
Stop the given job.
|
CompletableFuture<Acknowledge> |
submitJob(JobGraph jobGraph,
org.apache.flink.api.common.time.Time timeout)
Submit a job to the dispatcher.
|
CompletableFuture<String> |
triggerSavepoint(org.apache.flink.api.common.JobID jobId,
String targetDirectory,
boolean cancelJob,
org.apache.flink.api.common.time.Time timeout)
Triggers a savepoint with the given savepoint directory as a target.
|
callAsyncWithoutFencing, getFencingToken, getMainThreadExecutor, getUnfencedMainThreadExecutor, runAsyncWithoutFencing, setFencingTokencallAsync, getAddress, getEndpointId, getHostname, getRpcService, getSelfGateway, getTerminationFuture, runAsync, scheduleRunAsync, scheduleRunAsync, shutDown, stop, validateRunsInMainThreadclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFencingTokengetAddress, getHostnamegetAddresspublic static final String DISPATCHER_NAME
public Dispatcher(RpcService rpcService, String endpointId, org.apache.flink.configuration.Configuration configuration, HighAvailabilityServices highAvailabilityServices, SubmittedJobGraphStore submittedJobGraphStore, ResourceManagerGateway resourceManagerGateway, BlobServer blobServer, HeartbeatServices heartbeatServices, JobManagerMetricGroup jobManagerMetricGroup, @Nullable String metricServiceQueryPath, ArchivedExecutionGraphStore archivedExecutionGraphStore, Dispatcher.JobManagerRunnerFactory jobManagerRunnerFactory, FatalErrorHandler fatalErrorHandler, @Nullable String restAddress, HistoryServerArchivist historyServerArchivist) throws Exception
Exceptionpublic CompletableFuture<Void> postStop()
RpcEndpointThis 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.
postStop in class RpcEndpointpublic void start()
throws Exception
RpcEndpointIMPORTANT: Whenever you override this method, call the parent implementation to enable rpc processing. It is advised to make the parent call last.
start in class RpcEndpointException - indicating that something went wrong while starting the RPC endpointpublic CompletableFuture<Acknowledge> submitJob(JobGraph jobGraph, org.apache.flink.api.common.time.Time timeout)
DispatcherGatewaysubmitJob in interface DispatcherGatewayjobGraph - JobGraph to submittimeout - RPC timeoutpublic CompletableFuture<Collection<org.apache.flink.api.common.JobID>> listJobs(org.apache.flink.api.common.time.Time timeout)
DispatcherGatewaylistJobs in interface DispatcherGatewaytimeout - RPC timeoutpublic CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath, org.apache.flink.api.common.time.Time timeout)
RestfulGatewaydisposeSavepoint in interface RestfulGatewaysavepointPath - identifying the savepoint to disposetimeout - RPC timeoutpublic CompletableFuture<Acknowledge> cancelJob(org.apache.flink.api.common.JobID jobId, org.apache.flink.api.common.time.Time timeout)
RestfulGatewaycancelJob in interface RestfulGatewayjobId - identifying the job to canceltimeout - of the operationpublic CompletableFuture<Acknowledge> stopJob(org.apache.flink.api.common.JobID jobId, org.apache.flink.api.common.time.Time timeout)
RestfulGatewaystopJob in interface RestfulGatewayjobId - identifying the job to stoptimeout - of the operationpublic CompletableFuture<Acknowledge> rescaleJob(org.apache.flink.api.common.JobID jobId, int newParallelism, RescalingBehaviour rescalingBehaviour, org.apache.flink.api.common.time.Time timeout)
RestfulGatewayrescaleJob in interface RestfulGatewayjobId - specifying the job to rescalenewParallelism - new parallelism of the jobrescalingBehaviour - defining how strict the rescaling has to be executedtimeout - of this operationAcknowledge once the rescaling was successfulpublic CompletableFuture<String> requestRestAddress(org.apache.flink.api.common.time.Time timeout)
RestfulGatewayRpcEndpoint.requestRestAddress in interface RestfulGatewaytimeout - for this operationpublic CompletableFuture<ClusterOverview> requestClusterOverview(org.apache.flink.api.common.time.Time timeout)
RestfulGatewayrequestClusterOverview in interface RestfulGatewaytimeout - for the asynchronous operationpublic CompletableFuture<MultipleJobsDetails> requestMultipleJobDetails(org.apache.flink.api.common.time.Time timeout)
RestfulGatewayrequestMultipleJobDetails in interface RestfulGatewaytimeout - for the asynchronous operationpublic CompletableFuture<JobStatus> requestJobStatus(org.apache.flink.api.common.JobID jobId, org.apache.flink.api.common.time.Time timeout)
RestfulGatewayJobStatus of the given job.requestJobStatus in interface RestfulGatewayjobId - identifying the job for which to retrieve the JobStatustimeout - for the asynchronous operationJobStatus of the given jobpublic CompletableFuture<OperatorBackPressureStatsResponse> requestOperatorBackPressureStats(org.apache.flink.api.common.JobID jobId, JobVertexID jobVertexId)
RestfulGatewayrequestOperatorBackPressureStats in interface RestfulGatewayjobId - Job for which the stats are requested.jobVertexId - JobVertex for which the stats are requested.OperatorBackPressureStatsResponse or null if the stats are
not available (yet).public CompletableFuture<ArchivedExecutionGraph> requestJob(org.apache.flink.api.common.JobID jobId, org.apache.flink.api.common.time.Time timeout)
DispatcherGatewayArchivedExecutionGraph for the given jobId. If there is no such graph, then
the future is completed with a FlinkJobNotFoundException.
Note: We enforce that the returned future contains a ArchivedExecutionGraph unlike
the super interface.
requestJob in interface DispatcherGatewayrequestJob in interface RestfulGatewayjobId - identifying the job whose AccessExecutionGraph is requestedtimeout - for the asynchronous operationFlinkJobNotFoundExceptionpublic CompletableFuture<JobResult> requestJobResult(org.apache.flink.api.common.JobID jobId, org.apache.flink.api.common.time.Time timeout)
RestfulGatewayJobResult of a job specified by the given jobId.requestJobResult in interface RestfulGatewayjobId - identifying the job for which to retrieve the JobResult.timeout - for the asynchronous operationJobResult once the job has finishedpublic CompletableFuture<Collection<String>> requestMetricQueryServicePaths(org.apache.flink.api.common.time.Time timeout)
RestfulGatewayMetricQueryService to query.requestMetricQueryServicePaths in interface RestfulGatewaytimeout - for the asynchronous operationpublic CompletableFuture<Collection<org.apache.flink.api.java.tuple.Tuple2<ResourceID,String>>> requestTaskManagerMetricQueryServicePaths(org.apache.flink.api.common.time.Time timeout)
RestfulGatewayMetricQueryService to query.requestTaskManagerMetricQueryServicePaths in interface RestfulGatewaytimeout - for the asynchronous operationpublic CompletableFuture<Integer> getBlobServerPort(org.apache.flink.api.common.time.Time timeout)
DispatcherGatewaygetBlobServerPort in interface DispatcherGatewaytimeout - of the operationpublic CompletableFuture<String> triggerSavepoint(org.apache.flink.api.common.JobID jobId, String targetDirectory, boolean cancelJob, org.apache.flink.api.common.time.Time timeout)
RestfulGatewaytriggerSavepoint in interface RestfulGatewayjobId - ID of the job for which the savepoint should be triggered.targetDirectory - Target directory for the savepoint.timeout - Timeout for the asynchronous operationexternal pointer of
the savepoint.public CompletableFuture<Acknowledge> shutDownCluster()
shutDownCluster in interface RestfulGatewayprotected void onFatalError(Throwable throwable)
protected void jobReachedGloballyTerminalState(ArchivedExecutionGraph archivedExecutionGraph)
protected void jobNotFinished(org.apache.flink.api.common.JobID jobId)
public void grantLeadership(UUID newLeaderSessionID)
grantLeadership in interface LeaderContendernewLeaderSessionID - unique leadershipIDpublic void revokeLeadership()
revokeLeadership in interface LeaderContenderpublic void handleError(Exception exception)
handleError in interface LeaderContenderexception - Exception being thrown in the leader election servicepublic void onAddedJobGraph(org.apache.flink.api.common.JobID jobId)
SubmittedJobGraphStore.SubmittedJobGraphListenerSubmittedJobGraph instances added by a different SubmittedJobGraphStore instance.
Important: It is possible to get false positives and be notified about a job graph, which was added by this instance.
onAddedJobGraph in interface SubmittedJobGraphStore.SubmittedJobGraphListenerjobId - The JobID of the added job graphpublic void onRemovedJobGraph(org.apache.flink.api.common.JobID jobId)
SubmittedJobGraphStore.SubmittedJobGraphListenerSubmittedJobGraph instances removed by a different SubmittedJobGraphStore instance.onRemovedJobGraph in interface SubmittedJobGraphStore.SubmittedJobGraphListenerjobId - The JobID of the removed job graphCopyright © 2014–2019 The Apache Software Foundation. All rights reserved.