Class ClusterEntrypoint
- java.lang.Object
-
- org.apache.flink.runtime.entrypoint.ClusterEntrypoint
-
- All Implemented Interfaces:
AutoCloseable,org.apache.flink.runtime.rpc.FatalErrorHandler,org.apache.flink.util.AutoCloseableAsync
- Direct Known Subclasses:
SessionClusterEntrypoint
public abstract class ClusterEntrypoint extends Object implements org.apache.flink.util.AutoCloseableAsync, org.apache.flink.runtime.rpc.FatalErrorHandler
Base class for the Flink cluster entry points.Specialization of this class can be used for the session mode and the per-job mode
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClusterEntrypoint.ExecutionModeExecution mode of the dispatcher.protected static classClusterEntrypoint.ShutdownBehaviourShutdown behaviour of aClusterEntrypoint.
-
Field Summary
Fields Modifier and Type Field Description static org.apache.flink.configuration.ConfigOption<String>INTERNAL_CLUSTER_EXECUTION_MODEprotected static org.slf4j.LoggerLOGprotected static intRUNTIME_FAILURE_RETURN_CODEprotected static intSTARTUP_FAILURE_RETURN_CODE
-
Constructor Summary
Constructors Modifier Constructor Description protectedClusterEntrypoint(org.apache.flink.configuration.Configuration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcleanupDirectories(ClusterEntrypoint.ShutdownBehaviour shutdownBehaviour)Clean up of temporary directories created by theClusterEntrypoint.CompletableFuture<Void>closeAsync()protected abstract DispatcherResourceManagerComponentFactorycreateDispatcherResourceManagerComponentFactory(org.apache.flink.configuration.Configuration configuration)protected HighAvailabilityServicescreateHaServices(org.apache.flink.configuration.Configuration configuration, Executor executor, org.apache.flink.runtime.rpc.RpcSystemUtils rpcSystemUtils)protected HeartbeatServicescreateHeartbeatServices(org.apache.flink.configuration.Configuration configuration)protected MetricRegistryImplcreateMetricRegistry(org.apache.flink.configuration.Configuration configuration, org.apache.flink.core.plugin.PluginManager pluginManager, org.apache.flink.runtime.rpc.RpcSystemUtils rpcSystemUtils)protected abstract ExecutionGraphInfoStorecreateSerializableExecutionGraphStore(org.apache.flink.configuration.Configuration configuration, org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor)intgetRestPort()intgetRpcPort()protected StringgetRPCPortRange(org.apache.flink.configuration.Configuration configuration)Returns the port range for the commonRpcService.CompletableFuture<ApplicationStatus>getTerminationFuture()protected voidinitializeServices(org.apache.flink.configuration.Configuration configuration, org.apache.flink.core.plugin.PluginManager pluginManager)static SecurityContextinstallSecurityContext(org.apache.flink.configuration.Configuration configuration)protected static org.apache.flink.configuration.ConfigurationloadConfiguration(EntrypointClusterConfiguration entrypointClusterConfiguration)voidonFatalError(Throwable exception)static EntrypointClusterConfigurationparseArguments(String[] args)static voidrunClusterEntrypoint(ClusterEntrypoint clusterEntrypoint)voidstartCluster()protected CompletableFuture<Void>stopClusterServices(boolean cleanupHaData)protected booleansupportsReactiveMode()
-
-
-
Field Detail
-
INTERNAL_CLUSTER_EXECUTION_MODE
@Internal public static final org.apache.flink.configuration.ConfigOption<String> INTERNAL_CLUSTER_EXECUTION_MODE
-
LOG
protected static final org.slf4j.Logger LOG
-
STARTUP_FAILURE_RETURN_CODE
protected static final int STARTUP_FAILURE_RETURN_CODE
- See Also:
- Constant Field Values
-
RUNTIME_FAILURE_RETURN_CODE
protected static final int RUNTIME_FAILURE_RETURN_CODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRestPort
public int getRestPort()
-
getRpcPort
public int getRpcPort()
-
getTerminationFuture
public CompletableFuture<ApplicationStatus> getTerminationFuture()
-
startCluster
public void startCluster() throws ClusterEntrypointException- Throws:
ClusterEntrypointException
-
supportsReactiveMode
protected boolean supportsReactiveMode()
-
installSecurityContext
public static SecurityContext installSecurityContext(org.apache.flink.configuration.Configuration configuration) throws Exception
- Throws:
Exception
-
initializeServices
protected void initializeServices(org.apache.flink.configuration.Configuration configuration, org.apache.flink.core.plugin.PluginManager pluginManager) throws Exception- Throws:
Exception
-
getRPCPortRange
protected String getRPCPortRange(org.apache.flink.configuration.Configuration configuration)
Returns the port range for the commonRpcService.- Parameters:
configuration- to extract the port range from- Returns:
- Port range for the common
RpcService
-
createHaServices
protected HighAvailabilityServices createHaServices(org.apache.flink.configuration.Configuration configuration, Executor executor, org.apache.flink.runtime.rpc.RpcSystemUtils rpcSystemUtils) throws Exception
- Throws:
Exception
-
createHeartbeatServices
protected HeartbeatServices createHeartbeatServices(org.apache.flink.configuration.Configuration configuration)
-
createMetricRegistry
protected MetricRegistryImpl createMetricRegistry(org.apache.flink.configuration.Configuration configuration, org.apache.flink.core.plugin.PluginManager pluginManager, org.apache.flink.runtime.rpc.RpcSystemUtils rpcSystemUtils)
-
closeAsync
public CompletableFuture<Void> closeAsync()
- Specified by:
closeAsyncin interfaceorg.apache.flink.util.AutoCloseableAsync
-
stopClusterServices
protected CompletableFuture<Void> stopClusterServices(boolean cleanupHaData)
-
onFatalError
public void onFatalError(Throwable exception)
- Specified by:
onFatalErrorin interfaceorg.apache.flink.runtime.rpc.FatalErrorHandler
-
cleanupDirectories
protected void cleanupDirectories(ClusterEntrypoint.ShutdownBehaviour shutdownBehaviour) throws IOException
Clean up of temporary directories created by theClusterEntrypoint.- Parameters:
shutdownBehaviour- specifying the shutdown behaviour- Throws:
IOException- if the temporary directories could not be cleaned up
-
createDispatcherResourceManagerComponentFactory
protected abstract DispatcherResourceManagerComponentFactory createDispatcherResourceManagerComponentFactory(org.apache.flink.configuration.Configuration configuration) throws IOException
- Throws:
IOException
-
createSerializableExecutionGraphStore
protected abstract ExecutionGraphInfoStore createSerializableExecutionGraphStore(org.apache.flink.configuration.Configuration configuration, org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor) throws IOException
- Throws:
IOException
-
parseArguments
public static EntrypointClusterConfiguration parseArguments(String[] args) throws FlinkParseException
- Throws:
FlinkParseException
-
loadConfiguration
protected static org.apache.flink.configuration.Configuration loadConfiguration(EntrypointClusterConfiguration entrypointClusterConfiguration)
-
runClusterEntrypoint
public static void runClusterEntrypoint(ClusterEntrypoint clusterEntrypoint)
-
-