org.apache.flink.runtime.dispatcher.Dispatcher Java Examples
The following examples show how to use
org.apache.flink.runtime.dispatcher.Dispatcher.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationDispatcherGatewayServiceFactory.java From flink with Apache License 2.0 | 6 votes |
@Override public AbstractDispatcherLeaderProcess.DispatcherGatewayService create( DispatcherId fencingToken, Collection<JobGraph> recoveredJobs, JobGraphWriter jobGraphWriter) { final DispatcherBootstrap bootstrap = new ApplicationDispatcherBootstrap(application, recoveredJobs, configuration); final Dispatcher dispatcher; try { dispatcher = dispatcherFactory.createDispatcher( rpcService, fencingToken, bootstrap, PartialDispatcherServicesWithJobGraphStore.from(partialDispatcherServices, jobGraphWriter)); } catch (Exception e) { throw new FlinkRuntimeException("Could not create the Dispatcher rpc endpoint.", e); } dispatcher.start(); return DefaultDispatcherGatewayService.from(dispatcher); }
Example #2
Source File: SessionDispatcherResourceManagerComponentFactory.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override protected DispatcherResourceManagerComponent<Dispatcher> createDispatcherResourceManagerComponent( Dispatcher dispatcher, ResourceManager<?> resourceManager, LeaderRetrievalService dispatcherLeaderRetrievalService, LeaderRetrievalService resourceManagerRetrievalService, WebMonitorEndpoint<?> webMonitorEndpoint, JobManagerMetricGroup jobManagerMetricGroup) { return new SessionDispatcherResourceManagerComponent( dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint, jobManagerMetricGroup); }
Example #3
Source File: DefaultDispatcherGatewayServiceFactory.java From flink with Apache License 2.0 | 6 votes |
@Override public AbstractDispatcherLeaderProcess.DispatcherGatewayService create( DispatcherId fencingToken, Collection<JobGraph> recoveredJobs, JobGraphWriter jobGraphWriter) { final DispatcherBootstrap bootstrap = new DefaultDispatcherBootstrap(recoveredJobs); final Dispatcher dispatcher; try { dispatcher = dispatcherFactory.createDispatcher( rpcService, fencingToken, bootstrap, PartialDispatcherServicesWithJobGraphStore.from(partialDispatcherServices, jobGraphWriter)); } catch (Exception e) { throw new FlinkRuntimeException("Could not create the Dispatcher rpc endpoint.", e); } dispatcher.start(); return DefaultDispatcherGatewayService.from(dispatcher); }
Example #4
Source File: SessionDispatcherResourceManagerComponentFactory.java From flink with Apache License 2.0 | 6 votes |
@Override protected DispatcherResourceManagerComponent<Dispatcher> createDispatcherResourceManagerComponent( Dispatcher dispatcher, ResourceManager<?> resourceManager, LeaderRetrievalService dispatcherLeaderRetrievalService, LeaderRetrievalService resourceManagerRetrievalService, WebMonitorEndpoint<?> webMonitorEndpoint, JobManagerMetricGroup jobManagerMetricGroup) { return new SessionDispatcherResourceManagerComponent( dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint, jobManagerMetricGroup); }
Example #5
Source File: ApplicationDispatcherBootstrap.java From flink with Apache License 2.0 | 5 votes |
@Override public void initialize(final Dispatcher dispatcher, ScheduledExecutor scheduledExecutor) { checkNotNull(dispatcher); launchRecoveredJobGraphs(dispatcher, recoveredJobs); runApplicationAndShutdownClusterAsync( dispatcher, scheduledExecutor); }
Example #6
Source File: DefaultDispatcherRunnerITCase.java From flink with Apache License 2.0 | 5 votes |
@Override public Dispatcher createDispatcher( RpcService rpcService, DispatcherId fencingToken, DispatcherBootstrap dispatcherBootstrap, PartialDispatcherServicesWithJobGraphStore partialDispatcherServicesWithJobGraphStore) throws Exception { return new StandaloneDispatcher( rpcService, fencingToken, dispatcherBootstrap, DispatcherServices.from(partialDispatcherServicesWithJobGraphStore, jobManagerRunnerFactory)); }
Example #7
Source File: SessionDispatcherResourceManagerComponent.java From flink with Apache License 2.0 | 5 votes |
SessionDispatcherResourceManagerComponent( Dispatcher dispatcher, ResourceManager<?> resourceManager, LeaderRetrievalService dispatcherLeaderRetrievalService, LeaderRetrievalService resourceManagerRetrievalService, WebMonitorEndpoint<?> webMonitorEndpoint, JobManagerMetricGroup jobManagerMetricGroup) { super(dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint, jobManagerMetricGroup); }
Example #8
Source File: SessionDispatcherResourceManagerComponent.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
SessionDispatcherResourceManagerComponent( Dispatcher dispatcher, ResourceManager<?> resourceManager, LeaderRetrievalService dispatcherLeaderRetrievalService, LeaderRetrievalService resourceManagerRetrievalService, WebMonitorEndpoint<?> webMonitorEndpoint, JobManagerMetricGroup jobManagerMetricGroup) { super(dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint, jobManagerMetricGroup); }
Example #9
Source File: SessionDispatcherResourceManagerComponentFactory.java From flink with Apache License 2.0 | 4 votes |
@VisibleForTesting public SessionDispatcherResourceManagerComponentFactory( @Nonnull DispatcherFactory<Dispatcher> dispatcherFactory, @Nonnull ResourceManagerFactory<?> resourceManagerFactory) { super(dispatcherFactory, resourceManagerFactory, SessionRestEndpointFactory.INSTANCE); }
Example #10
Source File: YarnPreConfiguredMasterNonHaServices.java From flink with Apache License 2.0 | 4 votes |
/** * Creates new YarnPreConfiguredMasterHaServices for the given Flink and YARN configuration. * This constructor parses the ResourceManager address from the Flink configuration and sets * up the HDFS access to store recovery data in the YARN application's working directory. * * @param config The Flink configuration of this component / process. * @param hadoopConf The Hadoop configuration for the YARN cluster. * * @throws IOException * Thrown, if the initialization of the Hadoop file system used by YARN fails. * @throws IllegalConfigurationException * Thrown, if the Flink configuration does not properly describe the ResourceManager address and port. */ public YarnPreConfiguredMasterNonHaServices( Configuration config, org.apache.hadoop.conf.Configuration hadoopConf, HighAvailabilityServicesUtils.AddressResolution addressResolution) throws IOException { super(config, hadoopConf); // track whether we successfully perform the initialization boolean successful = false; try { // extract the hostname and port of the resource manager final String rmHost = config.getString(YarnConfigOptions.APP_MASTER_RPC_ADDRESS); final int rmPort = config.getInteger(YarnConfigOptions.APP_MASTER_RPC_PORT); if (rmHost == null) { throw new IllegalConfigurationException("Config parameter '" + YarnConfigOptions.APP_MASTER_RPC_ADDRESS.key() + "' is missing."); } if (rmPort < 0) { throw new IllegalConfigurationException("Config parameter '" + YarnConfigOptions.APP_MASTER_RPC_PORT.key() + "' is missing."); } if (rmPort <= 0 || rmPort >= 65536) { throw new IllegalConfigurationException("Invalid value for '" + YarnConfigOptions.APP_MASTER_RPC_PORT.key() + "' - port must be in [1, 65535]"); } this.resourceManagerRpcUrl = AkkaRpcServiceUtils.getRpcUrl( rmHost, rmPort, ResourceManager.RESOURCE_MANAGER_NAME, addressResolution, config); this.dispatcherRpcUrl = AkkaRpcServiceUtils.getRpcUrl( rmHost, rmPort, Dispatcher.DISPATCHER_NAME, addressResolution, config); // all well! successful = true; } finally { if (!successful) { // quietly undo what the parent constructor initialized try { super.close(); } catch (Throwable ignored) {} } } }
Example #11
Source File: HighAvailabilityServicesUtils.java From flink with Apache License 2.0 | 4 votes |
public static HighAvailabilityServices createHighAvailabilityServices( Configuration configuration, Executor executor, AddressResolution addressResolution) throws Exception { HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration); switch (highAvailabilityMode) { case NONE: final Tuple2<String, Integer> hostnamePort = getJobManagerAddress(configuration); final String jobManagerRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, JobMaster.JOB_MANAGER_NAME, addressResolution, configuration); final String resourceManagerRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, ResourceManager.RESOURCE_MANAGER_NAME, addressResolution, configuration); final String dispatcherRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, Dispatcher.DISPATCHER_NAME, addressResolution, configuration); final String address = checkNotNull(configuration.getString(RestOptions.ADDRESS), "%s must be set", RestOptions.ADDRESS.key()); final int port = configuration.getInteger(RestOptions.PORT); final boolean enableSSL = SSLUtils.isRestSSLEnabled(configuration); final String protocol = enableSSL ? "https://" : "http://"; return new StandaloneHaServices( resourceManagerRpcUrl, dispatcherRpcUrl, jobManagerRpcUrl, String.format("%s%s:%s", protocol, address, port)); case ZOOKEEPER: BlobStoreService blobStoreService = BlobUtils.createBlobStoreFromConfig(configuration); return new ZooKeeperHaServices( ZooKeeperUtils.startCuratorFramework(configuration), executor, configuration, blobStoreService); case FACTORY_CLASS: return createCustomHAServices(configuration, executor); default: throw new Exception("Recovery mode " + highAvailabilityMode + " is not supported."); } }
Example #12
Source File: HighAvailabilityServicesUtils.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public static HighAvailabilityServices createHighAvailabilityServices( Configuration configuration, Executor executor, AddressResolution addressResolution) throws Exception { HighAvailabilityMode highAvailabilityMode = LeaderRetrievalUtils.getRecoveryMode(configuration); switch (highAvailabilityMode) { case NONE: final Tuple2<String, Integer> hostnamePort = getJobManagerAddress(configuration); final String jobManagerRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, JobMaster.JOB_MANAGER_NAME, addressResolution, configuration); final String resourceManagerRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, ResourceManager.RESOURCE_MANAGER_NAME, addressResolution, configuration); final String dispatcherRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, Dispatcher.DISPATCHER_NAME, addressResolution, configuration); final String address = checkNotNull(configuration.getString(RestOptions.ADDRESS), "%s must be set", RestOptions.ADDRESS.key()); final int port = configuration.getInteger(RestOptions.PORT); final boolean enableSSL = SSLUtils.isRestSSLEnabled(configuration); final String protocol = enableSSL ? "https://" : "http://"; return new StandaloneHaServices( resourceManagerRpcUrl, dispatcherRpcUrl, jobManagerRpcUrl, String.format("%s%s:%s", protocol, address, port)); case ZOOKEEPER: BlobStoreService blobStoreService = BlobUtils.createBlobStoreFromConfig(configuration); return new ZooKeeperHaServices( ZooKeeperUtils.startCuratorFramework(configuration), executor, configuration, blobStoreService); case FACTORY_CLASS: return createCustomHAServices(configuration, executor); default: throw new Exception("Recovery mode " + highAvailabilityMode + " is not supported."); } }
Example #13
Source File: DefaultDispatcherGatewayService.java From flink with Apache License 2.0 | 4 votes |
private DefaultDispatcherGatewayService(Dispatcher dispatcher) { this.dispatcher = dispatcher; this.dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class); }
Example #14
Source File: DefaultDispatcherGatewayService.java From flink with Apache License 2.0 | 4 votes |
public static DefaultDispatcherGatewayService from(Dispatcher dispatcher) { return new DefaultDispatcherGatewayService(dispatcher); }
Example #15
Source File: HighAvailabilityServicesUtils.java From flink with Apache License 2.0 | 4 votes |
public static HighAvailabilityServices createHighAvailabilityServices( Configuration configuration, Executor executor, AddressResolution addressResolution) throws Exception { HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration); switch (highAvailabilityMode) { case NONE: final Tuple2<String, Integer> hostnamePort = getJobManagerAddress(configuration); final String resourceManagerRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, AkkaRpcServiceUtils.createWildcardName(ResourceManager.RESOURCE_MANAGER_NAME), addressResolution, configuration); final String dispatcherRpcUrl = AkkaRpcServiceUtils.getRpcUrl( hostnamePort.f0, hostnamePort.f1, AkkaRpcServiceUtils.createWildcardName(Dispatcher.DISPATCHER_NAME), addressResolution, configuration); final String webMonitorAddress = getWebMonitorAddress( configuration, addressResolution); return new StandaloneHaServices( resourceManagerRpcUrl, dispatcherRpcUrl, webMonitorAddress); case ZOOKEEPER: BlobStoreService blobStoreService = BlobUtils.createBlobStoreFromConfig(configuration); return new ZooKeeperHaServices( ZooKeeperUtils.startCuratorFramework(configuration), executor, configuration, blobStoreService); case FACTORY_CLASS: return createCustomHAServices(configuration, executor); default: throw new Exception("Recovery mode " + highAvailabilityMode + " is not supported."); } }
Example #16
Source File: SessionDispatcherResourceManagerComponentFactory.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@VisibleForTesting public SessionDispatcherResourceManagerComponentFactory( @Nonnull DispatcherFactory<Dispatcher> dispatcherFactory, @Nonnull ResourceManagerFactory<?> resourceManagerFactory) { super(dispatcherFactory, resourceManagerFactory, SessionRestEndpointFactory.INSTANCE); }
Example #17
Source File: YarnPreConfiguredMasterNonHaServices.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * Creates new YarnPreConfiguredMasterHaServices for the given Flink and YARN configuration. * This constructor parses the ResourceManager address from the Flink configuration and sets * up the HDFS access to store recovery data in the YARN application's working directory. * * @param config The Flink configuration of this component / process. * @param hadoopConf The Hadoop configuration for the YARN cluster. * * @throws IOException * Thrown, if the initialization of the Hadoop file system used by YARN fails. * @throws IllegalConfigurationException * Thrown, if the Flink configuration does not properly describe the ResourceManager address and port. */ public YarnPreConfiguredMasterNonHaServices( Configuration config, org.apache.hadoop.conf.Configuration hadoopConf, HighAvailabilityServicesUtils.AddressResolution addressResolution) throws IOException { super(config, hadoopConf); // track whether we successfully perform the initialization boolean successful = false; try { // extract the hostname and port of the resource manager final String rmHost = config.getString(YarnConfigOptions.APP_MASTER_RPC_ADDRESS); final int rmPort = config.getInteger(YarnConfigOptions.APP_MASTER_RPC_PORT); if (rmHost == null) { throw new IllegalConfigurationException("Config parameter '" + YarnConfigOptions.APP_MASTER_RPC_ADDRESS.key() + "' is missing."); } if (rmPort < 0) { throw new IllegalConfigurationException("Config parameter '" + YarnConfigOptions.APP_MASTER_RPC_PORT.key() + "' is missing."); } if (rmPort <= 0 || rmPort >= 65536) { throw new IllegalConfigurationException("Invalid value for '" + YarnConfigOptions.APP_MASTER_RPC_PORT.key() + "' - port must be in [1, 65535]"); } this.resourceManagerRpcUrl = AkkaRpcServiceUtils.getRpcUrl( rmHost, rmPort, ResourceManager.RESOURCE_MANAGER_NAME, addressResolution, config); this.dispatcherRpcUrl = AkkaRpcServiceUtils.getRpcUrl( rmHost, rmPort, Dispatcher.DISPATCHER_NAME, addressResolution, config); // all well! successful = true; } finally { if (!successful) { // quietly undo what the parent constructor initialized try { super.close(); } catch (Throwable ignored) {} } } }