Class WebMonitorEndpoint<T extends RestfulGateway>
- java.lang.Object
-
- org.apache.flink.runtime.rest.RestServerEndpoint
-
- org.apache.flink.runtime.webmonitor.WebMonitorEndpoint<T>
-
- Type Parameters:
T- type of the leader gateway
- All Implemented Interfaces:
AutoCloseable,LeaderContender,RestService,JsonArchivist,org.apache.flink.util.AutoCloseableAsync
- Direct Known Subclasses:
DispatcherRestEndpoint,MiniDispatcherRestEndpoint
public class WebMonitorEndpoint<T extends RestfulGateway> extends RestServerEndpoint implements LeaderContender, JsonArchivist
Rest endpoint which serves the web frontend REST calls.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
RestServerEndpoint.RestHandlerUrlComparator
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.flink.configuration.ConfigurationclusterConfigurationprotected ScheduledExecutorServiceexecutorprotected GatewayRetriever<? extends T>leaderRetrieverprotected RestHandlerConfigurationrestConfiguration-
Fields inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
log, responseHeaders, uploadDir
-
-
Constructor Summary
Constructors Constructor Description WebMonitorEndpoint(GatewayRetriever<? extends T> leaderRetriever, org.apache.flink.configuration.Configuration clusterConfiguration, RestHandlerConfiguration restConfiguration, GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever, TransientBlobService transientBlobService, ScheduledExecutorService executor, MetricFetcher metricFetcher, LeaderElection leaderElection, ExecutionGraphCache executionGraphCache, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<ArchivedJson>archiveJsonWithPath(ExecutionGraphInfo executionGraphInfo)Returns aCollectionofArchivedJsons containing JSON responses and their respective REST URL for a given job.static ScheduledExecutorServicecreateExecutorService(int numThreads, int threadPriority, String componentName)voidgrantLeadership(UUID leaderSessionID)Callback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader.voidhandleError(Exception exception)Callback method which is called byLeaderElectionServicein case of an error in the service thread.protected List<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>>initializeHandlers(CompletableFuture<String> localAddressFuture)This method is called at the beginning ofRestServerEndpoint.start()to setup all handlers that the REST server endpoint implementation requires.protected Collection<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>>initializeWebSubmissionHandlers(CompletableFuture<String> localAddressFuture)voidrevokeLeadership()Callback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader.protected CompletableFuture<Void>shutDownInternal()Stops this REST server endpoint.voidstartInternal()Hook to start sub class specific services.-
Methods inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
closeAsync, getRestBaseUrl, getRestPort, getServerAddress, start
-
-
-
-
Field Detail
-
leaderRetriever
protected final GatewayRetriever<? extends T extends RestfulGateway> leaderRetriever
-
clusterConfiguration
protected final org.apache.flink.configuration.Configuration clusterConfiguration
-
restConfiguration
protected final RestHandlerConfiguration restConfiguration
-
executor
protected final ScheduledExecutorService executor
-
-
Constructor Detail
-
WebMonitorEndpoint
public WebMonitorEndpoint(GatewayRetriever<? extends T> leaderRetriever, org.apache.flink.configuration.Configuration clusterConfiguration, RestHandlerConfiguration restConfiguration, GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever, TransientBlobService transientBlobService, ScheduledExecutorService executor, MetricFetcher metricFetcher, LeaderElection leaderElection, ExecutionGraphCache executionGraphCache, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler) throws IOException, org.apache.flink.util.ConfigurationException
- Throws:
IOExceptionorg.apache.flink.util.ConfigurationException
-
-
Method Detail
-
initializeHandlers
protected List<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> localAddressFuture)
Description copied from class:RestServerEndpointThis method is called at the beginning ofRestServerEndpoint.start()to setup all handlers that the REST server endpoint implementation requires.- Specified by:
initializeHandlersin classRestServerEndpoint- Parameters:
localAddressFuture- future rest address of the RestServerEndpoint- Returns:
- Collection of AbstractRestHandler which are added to the server endpoint
-
initializeWebSubmissionHandlers
protected Collection<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeWebSubmissionHandlers(CompletableFuture<String> localAddressFuture)
-
startInternal
public void startInternal() throws ExceptionDescription copied from class:RestServerEndpointHook to start sub class specific services.- Specified by:
startInternalin classRestServerEndpoint- Throws:
Exception- if an error occurred
-
shutDownInternal
protected CompletableFuture<Void> shutDownInternal()
Description copied from class:RestServerEndpointStops this REST server endpoint.- Overrides:
shutDownInternalin classRestServerEndpoint- Returns:
- Future which is completed once the shut down has been finished.
-
grantLeadership
public void grantLeadership(UUID leaderSessionID)
Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader. The method is called with the new leader session ID.- Specified by:
grantLeadershipin interfaceLeaderContender- Parameters:
leaderSessionID- New leader session ID
-
revokeLeadership
public void revokeLeadership()
Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader. This might happen in case that multiple contenders have been granted leadership.- Specified by:
revokeLeadershipin interfaceLeaderContender
-
handleError
public void handleError(Exception exception)
Description copied from interface:LeaderContenderCallback method which is called byLeaderElectionServicein case of an error in the service thread.- Specified by:
handleErrorin interfaceLeaderContender- Parameters:
exception- Caught exception
-
archiveJsonWithPath
public Collection<ArchivedJson> archiveJsonWithPath(ExecutionGraphInfo executionGraphInfo) throws IOException
Description copied from interface:JsonArchivistReturns aCollectionofArchivedJsons containing JSON responses and their respective REST URL for a given job.The collection should contain one entry for every response that could be generated for the given job, for example one entry for each task. The REST URLs should be unique and must not contain placeholders.
- Specified by:
archiveJsonWithPathin interfaceJsonArchivist- Parameters:
executionGraphInfo-AccessExecutionGraph-related information for which the responses should be generated- Returns:
- Collection containing an ArchivedJson for every response that could be generated for the given job
- Throws:
IOException- thrown if the JSON generation fails
-
createExecutorService
public static ScheduledExecutorService createExecutorService(int numThreads, int threadPriority, String componentName)
-
-