public abstract class Dispatcher extends FencedRpcEndpoint<DispatcherId> implements DispatcherGateway, LeaderContender
RpcEndpoint.MainThreadExecutor
Modifier and Type | Field and Description |
---|---|
static String |
DISPATCHER_NAME |
log, rpcServer
Modifier | Constructor and Description |
---|---|
protected |
Dispatcher(RpcService rpcService,
String endpointId,
Configuration configuration,
HighAvailabilityServices highAvailabilityServices,
ResourceManagerGateway resourceManagerGateway,
BlobServer blobServer,
HeartbeatServices heartbeatServices,
MetricRegistry metricRegistry,
FatalErrorHandler fatalErrorHandler,
Optional<String> restAddress) |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Acknowledge> |
cancelJob(JobID jobId,
Time timeout)
Cancel the given job.
|
protected abstract JobManagerRunner |
createJobManagerRunner(ResourceID resourceId,
JobGraph jobGraph,
Configuration configuration,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
JobManagerServices jobManagerServices,
MetricRegistry metricRegistry,
OnCompletionActions onCompleteActions,
FatalErrorHandler fatalErrorHandler) |
CompletableFuture<Integer> |
getBlobServerPort(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.
|
CompletableFuture<Collection<JobID>> |
listJobs(Time timeout)
List the current set of submitted jobs.
|
void |
postStop()
User overridable callback.
|
CompletableFuture<ClusterOverview> |
requestClusterOverview(Time timeout)
Requests the cluster status overview.
|
CompletableFuture<AccessExecutionGraph> |
requestJob(JobID jobId,
Time timeout)
Requests the AccessExecutionGraph for the given jobId.
|
CompletableFuture<MultipleJobsDetails> |
requestJobDetails(boolean includeRunning,
boolean includeFinished,
Time timeout)
Requests job details currently being executed on the Flink cluster.
|
CompletableFuture<Collection<String>> |
requestMetricQueryServicePaths(Time timeout)
Requests the paths for the
MetricQueryService to query. |
CompletableFuture<String> |
requestRestAddress(Time timeout)
Requests the REST address of this
RpcEndpoint . |
CompletableFuture<Collection<Tuple2<ResourceID,String>>> |
requestTaskManagerMetricQueryServicePaths(Time timeout)
Requests the paths for the TaskManager's
MetricQueryService to query. |
void |
revokeLeadership()
Callback method when current resourceManager loses leadership.
|
void |
start()
Starts the rpc endpoint.
|
CompletableFuture<Acknowledge> |
stopJob(JobID jobId,
Time timeout)
Stop the given job.
|
CompletableFuture<Acknowledge> |
submitJob(JobGraph jobGraph,
Time timeout)
Submit a job to the dispatcher.
|
callAsyncWithoutFencing, getFencingToken, getMainThreadExecutor, runAsyncWithoutFencing, setFencingToken
callAsync, getAddress, getEndpointId, getHostname, getRpcService, getSelfGateway, getTerminationFuture, runAsync, scheduleRunAsync, scheduleRunAsync, shutDown, stop, validateRunsInMainThread
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFencingToken
getAddress, getHostname
getAddress
public static final String DISPATCHER_NAME
protected Dispatcher(RpcService rpcService, String endpointId, Configuration configuration, HighAvailabilityServices highAvailabilityServices, ResourceManagerGateway resourceManagerGateway, BlobServer blobServer, HeartbeatServices heartbeatServices, MetricRegistry metricRegistry, FatalErrorHandler fatalErrorHandler, Optional<String> restAddress) throws Exception
Exception
public void postStop() throws Exception
RpcEndpoint
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.
postStop
in class RpcEndpoint
Exception
- if an error occurs. The exception is returned as result of the termination future.public void start() throws Exception
RpcEndpoint
start
in class RpcEndpoint
Exception
- indicating that something went wrong while starting the RPC endpointpublic CompletableFuture<Acknowledge> submitJob(JobGraph jobGraph, Time timeout)
DispatcherGateway
submitJob
in interface DispatcherGateway
jobGraph
- JobGraph to submittimeout
- RPC timeoutpublic CompletableFuture<Collection<JobID>> listJobs(Time timeout)
DispatcherGateway
listJobs
in interface DispatcherGateway
timeout
- RPC timeoutpublic CompletableFuture<Acknowledge> cancelJob(JobID jobId, Time timeout)
DispatcherGateway
cancelJob
in interface DispatcherGateway
jobId
- identifying the job to canceltimeout
- of the operationpublic CompletableFuture<Acknowledge> stopJob(JobID jobId, Time timeout)
DispatcherGateway
stopJob
in interface DispatcherGateway
jobId
- identifying the job to stoptimeout
- of the operationpublic CompletableFuture<String> requestRestAddress(Time timeout)
RestfulGateway
RpcEndpoint
.requestRestAddress
in interface RestfulGateway
timeout
- for this operationpublic CompletableFuture<ClusterOverview> requestClusterOverview(Time timeout)
RestfulGateway
requestClusterOverview
in interface RestfulGateway
timeout
- for the asynchronous operationpublic CompletableFuture<MultipleJobsDetails> requestJobDetails(boolean includeRunning, boolean includeFinished, Time timeout)
RestfulGateway
requestJobDetails
in interface RestfulGateway
includeRunning
- true if running jobs shall be included, otherwise falseincludeFinished
- true if finished jobs shall be included, otherwise falsetimeout
- for the asynchronous operationpublic CompletableFuture<AccessExecutionGraph> requestJob(JobID jobId, Time timeout)
RestfulGateway
FlinkJobNotFoundException
.requestJob
in interface RestfulGateway
jobId
- identifying the job whose AccessExecutionGraph is requestedtimeout
- for the asynchronous operationFlinkJobNotFoundException
public CompletableFuture<Collection<String>> requestMetricQueryServicePaths(Time timeout)
RestfulGateway
MetricQueryService
to query.requestMetricQueryServicePaths
in interface RestfulGateway
timeout
- for the asynchronous operationpublic CompletableFuture<Collection<Tuple2<ResourceID,String>>> requestTaskManagerMetricQueryServicePaths(Time timeout)
RestfulGateway
MetricQueryService
to query.requestTaskManagerMetricQueryServicePaths
in interface RestfulGateway
timeout
- for the asynchronous operationpublic CompletableFuture<Integer> getBlobServerPort(Time timeout)
DispatcherGateway
getBlobServerPort
in interface DispatcherGateway
timeout
- of the operationprotected abstract JobManagerRunner createJobManagerRunner(ResourceID resourceId, JobGraph jobGraph, Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, JobManagerServices jobManagerServices, MetricRegistry metricRegistry, OnCompletionActions onCompleteActions, FatalErrorHandler fatalErrorHandler) throws Exception
Exception
public void grantLeadership(UUID newLeaderSessionID)
grantLeadership
in interface LeaderContender
newLeaderSessionID
- unique leadershipIDpublic void revokeLeadership()
revokeLeadership
in interface LeaderContender
public void handleError(Exception exception)
handleError
in interface LeaderContender
exception
- Exception being thrown in the leader election serviceCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.