Java Code Examples for org.apache.flink.runtime.entrypoint.ClusterEntrypoint#ExecutionMode
The following examples show how to use
org.apache.flink.runtime.entrypoint.ClusterEntrypoint#ExecutionMode .
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: MiniDispatcherTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Nonnull private MiniDispatcher createMiniDispatcher(ClusterEntrypoint.ExecutionMode executionMode) throws Exception { return new MiniDispatcher( rpcService, UUID.randomUUID().toString(), configuration, highAvailabilityServices, () -> CompletableFuture.completedFuture(resourceManagerGateway), blobServer, heartbeatServices, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(), null, archivedExecutionGraphStore, testingJobManagerRunnerFactory, testingFatalErrorHandler, VoidHistoryServerArchivist.INSTANCE, jobGraph, executionMode); }
Example 2
Source File: MiniDispatcherTest.java From flink with Apache License 2.0 | 6 votes |
@Nonnull private MiniDispatcher createMiniDispatcher(ClusterEntrypoint.ExecutionMode executionMode) throws Exception { return new MiniDispatcher( rpcService, UUID.randomUUID().toString(), configuration, highAvailabilityServices, () -> CompletableFuture.completedFuture(resourceManagerGateway), blobServer, heartbeatServices, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(), null, archivedExecutionGraphStore, testingJobManagerRunnerFactory, testingFatalErrorHandler, VoidHistoryServerArchivist.INSTANCE, jobGraph, executionMode); }
Example 3
Source File: YarnJobDescriptor.java From sylph with Apache License 2.0 | 6 votes |
public ClusterClient<ApplicationId> deploy(JobGraph jobGraph, boolean detached) throws Exception { // this is required because the slots are allocated lazily jobGraph.setAllowQueuedScheduling(true); // ApplicationReport report = startAppMaster(jobGraph); Configuration flinkConfiguration = getFlinkConfiguration(); ClusterEntrypoint.ExecutionMode executionMode = detached ? ClusterEntrypoint.ExecutionMode.DETACHED : ClusterEntrypoint.ExecutionMode.NORMAL; flinkConfiguration.setString(ClusterEntrypoint.EXECUTION_MODE, executionMode.toString()); String host = report.getHost(); int port = report.getRpcPort(); flinkConfiguration.setString(JobManagerOptions.ADDRESS, host); flinkConfiguration.setInteger(JobManagerOptions.PORT, port); flinkConfiguration.setString(RestOptions.ADDRESS, host); flinkConfiguration.setInteger(RestOptions.PORT, port); return new RestClusterClient<>(flinkConfiguration, report.getApplicationId()); }
Example 4
Source File: MiniDispatcherTest.java From flink with Apache License 2.0 | 6 votes |
@Nonnull private MiniDispatcher createMiniDispatcher(ClusterEntrypoint.ExecutionMode executionMode) throws Exception { return new MiniDispatcher( rpcService, DispatcherId.generate(), new DispatcherServices( configuration, highAvailabilityServices, () -> CompletableFuture.completedFuture(resourceManagerGateway), blobServer, heartbeatServices, archivedExecutionGraphStore, testingFatalErrorHandlerResource.getFatalErrorHandler(), VoidHistoryServerArchivist.INSTANCE, null, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(), highAvailabilityServices.getJobGraphStore(), testingJobManagerRunnerFactory), new DefaultDispatcherBootstrap(Collections.singletonList(jobGraph)), executionMode); }
Example 5
Source File: JobDispatcherFactory.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public MiniDispatcher createDispatcher( Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever, BlobServer blobServer, HeartbeatServices heartbeatServices, JobManagerMetricGroup jobManagerMetricGroup, @Nullable String metricQueryServicePath, ArchivedExecutionGraphStore archivedExecutionGraphStore, FatalErrorHandler fatalErrorHandler, HistoryServerArchivist historyServerArchivist) throws Exception { final JobGraph jobGraph = jobGraphRetriever.retrieveJobGraph(configuration); final String executionModeValue = configuration.getString(EXECUTION_MODE); final ClusterEntrypoint.ExecutionMode executionMode = ClusterEntrypoint.ExecutionMode.valueOf(executionModeValue); return new MiniDispatcher( rpcService, getEndpointId(), configuration, highAvailabilityServices, resourceManagerGatewayRetriever, blobServer, heartbeatServices, jobManagerMetricGroup, metricQueryServicePath, archivedExecutionGraphStore, DefaultJobManagerRunnerFactory.INSTANCE, fatalErrorHandler, historyServerArchivist, jobGraph, executionMode); }
Example 6
Source File: JobDispatcherFactory.java From flink with Apache License 2.0 | 5 votes |
@Override public MiniDispatcher createDispatcher( Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever, BlobServer blobServer, HeartbeatServices heartbeatServices, JobManagerMetricGroup jobManagerMetricGroup, @Nullable String metricQueryServiceAddress, ArchivedExecutionGraphStore archivedExecutionGraphStore, FatalErrorHandler fatalErrorHandler, HistoryServerArchivist historyServerArchivist) throws Exception { final JobGraph jobGraph = jobGraphRetriever.retrieveJobGraph(configuration); final String executionModeValue = configuration.getString(EXECUTION_MODE); final ClusterEntrypoint.ExecutionMode executionMode = ClusterEntrypoint.ExecutionMode.valueOf(executionModeValue); return new MiniDispatcher( rpcService, getEndpointId(), configuration, highAvailabilityServices, resourceManagerGatewayRetriever, blobServer, heartbeatServices, jobManagerMetricGroup, metricQueryServiceAddress, archivedExecutionGraphStore, DefaultJobManagerRunnerFactory.INSTANCE, fatalErrorHandler, historyServerArchivist, jobGraph, executionMode); }
Example 7
Source File: KubernetesClusterDescriptor.java From flink with Apache License 2.0 | 4 votes |
private ClusterClientProvider<String> deployClusterInternal( String entryPoint, ClusterSpecification clusterSpecification, boolean detached) throws ClusterDeploymentException { final ClusterEntrypoint.ExecutionMode executionMode = detached ? ClusterEntrypoint.ExecutionMode.DETACHED : ClusterEntrypoint.ExecutionMode.NORMAL; flinkConfig.setString(ClusterEntrypoint.EXECUTION_MODE, executionMode.toString()); flinkConfig.setString(KubernetesConfigOptionsInternal.ENTRY_POINT_CLASS, entryPoint); // Rpc, blob, rest, taskManagerRpc ports need to be exposed, so update them to fixed values. KubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, BlobServerOptions.PORT, Constants.BLOB_SERVER_PORT); KubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, TaskManagerOptions.RPC_PORT, Constants.TASK_MANAGER_RPC_PORT); KubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, RestOptions.BIND_PORT, Constants.REST_PORT); if (HighAvailabilityMode.isHighAvailabilityModeActivated(flinkConfig)) { flinkConfig.setString(HighAvailabilityOptions.HA_CLUSTER_ID, clusterId); KubernetesUtils.checkAndUpdatePortConfigOption( flinkConfig, HighAvailabilityOptions.HA_JOB_MANAGER_PORT_RANGE, flinkConfig.get(JobManagerOptions.PORT)); } try { final KubernetesJobManagerParameters kubernetesJobManagerParameters = new KubernetesJobManagerParameters(flinkConfig, clusterSpecification); final KubernetesJobManagerSpecification kubernetesJobManagerSpec = KubernetesJobManagerFactory.buildKubernetesJobManagerSpecification(kubernetesJobManagerParameters); client.createJobManagerComponent(kubernetesJobManagerSpec); return createClusterClientProvider(clusterId); } catch (Exception e) { try { LOG.warn("Failed to create the Kubernetes cluster \"{}\", try to clean up the residual resources.", clusterId); client.stopAndCleanupCluster(clusterId); } catch (Exception e1) { LOG.info("Failed to stop and clean up the Kubernetes cluster \"{}\".", clusterId, e1); } throw new ClusterDeploymentException("Could not create Kubernetes cluster \"" + clusterId + "\".", e); } }