Java Code Examples for org.apache.flink.runtime.jobgraph.SavepointRestoreSettings#toConfiguration()
The following examples show how to use
org.apache.flink.runtime.jobgraph.SavepointRestoreSettings#toConfiguration() .
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: JarRunHandler.java From flink with Apache License 2.0 | 6 votes |
@Override protected CompletableFuture<JarRunResponseBody> handleRequest( @Nonnull final HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request, @Nonnull final DispatcherGateway gateway) throws RestHandlerException { final Configuration effectiveConfiguration = new Configuration(configuration); effectiveConfiguration.set(DeploymentOptions.ATTACHED, false); effectiveConfiguration.set(DeploymentOptions.TARGET, EmbeddedExecutor.NAME); final JarHandlerContext context = JarHandlerContext.fromRequest(request, jarDir, log); context.applyToConfiguration(effectiveConfiguration); SavepointRestoreSettings.toConfiguration(getSavepointRestoreSettings(request), effectiveConfiguration); final PackagedProgram program = context.toPackagedProgram(effectiveConfiguration); return CompletableFuture .supplyAsync(() -> applicationRunner.run(gateway, program, effectiveConfiguration), executor) .thenApply(jobIds -> { if (jobIds.isEmpty()) { throw new CompletionException(new ProgramInvocationException("No jobs submitted.")); } return new JarRunResponseBody(jobIds.get(0)); }); }
Example 2
Source File: ClassPathPackagedProgramRetrieverTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testSavepointRestoreSettings() throws FlinkException, IOException, ProgramInvocationException { final Configuration configuration = new Configuration(); final SavepointRestoreSettings savepointRestoreSettings = SavepointRestoreSettings.forPath("foobar", true); final JobID jobId = new JobID(); configuration.setString(PipelineOptionsInternal.PIPELINE_FIXED_JOB_ID, jobId.toHexString()); SavepointRestoreSettings.toConfiguration(savepointRestoreSettings, configuration); final ClassPathPackagedProgramRetriever retrieverUnderTest = ClassPathPackagedProgramRetriever.newBuilder(PROGRAM_ARGUMENTS) .setJobClassName(TestJob.class.getCanonicalName()) .build(); final JobGraph jobGraph = retrieveJobGraph(retrieverUnderTest, configuration); assertThat(jobGraph.getSavepointRestoreSettings(), is(equalTo(savepointRestoreSettings))); assertEquals(jobGraph.getJobID(), jobId); }
Example 3
Source File: RemoteStreamEnvironment.java From flink with Apache License 2.0 | 6 votes |
private static Configuration getEffectiveConfiguration( final Configuration baseConfiguration, final String host, final int port, final String[] jars, final List<URL> classpaths, final SavepointRestoreSettings savepointRestoreSettings) { final Configuration effectiveConfiguration = new Configuration(baseConfiguration); RemoteEnvironmentConfigUtils.setJobManagerAddressToConfig(host, port, effectiveConfiguration); RemoteEnvironmentConfigUtils.setJarURLsToConfig(jars, effectiveConfiguration); ConfigUtils.encodeCollectionToConfig(effectiveConfiguration, PipelineOptions.CLASSPATHS, classpaths, URL::toString); if (savepointRestoreSettings != null) { SavepointRestoreSettings.toConfiguration(savepointRestoreSettings, effectiveConfiguration); } else { SavepointRestoreSettings.toConfiguration(SavepointRestoreSettings.none(), effectiveConfiguration); } // these should be set in the end to overwrite any values from the client config provided in the constructor. effectiveConfiguration.setString(DeploymentOptions.TARGET, "remote"); effectiveConfiguration.setBoolean(DeploymentOptions.ATTACHED, true); return effectiveConfiguration; }
Example 4
Source File: StandaloneApplicationClusterEntryPoint.java From flink with Apache License 2.0 | 5 votes |
@VisibleForTesting static Configuration loadConfigurationFromClusterConfig(StandaloneApplicationClusterConfiguration clusterConfiguration) { Configuration configuration = loadConfiguration(clusterConfiguration); setStaticJobId(clusterConfiguration, configuration); SavepointRestoreSettings.toConfiguration(clusterConfiguration.getSavepointRestoreSettings(), configuration); return configuration; }
Example 5
Source File: ProgramOptions.java From flink with Apache License 2.0 | 5 votes |
public void applyToConfiguration(Configuration configuration) { if (getParallelism() != ExecutionConfig.PARALLELISM_DEFAULT) { configuration.setInteger(CoreOptions.DEFAULT_PARALLELISM, getParallelism()); } configuration.setBoolean(DeploymentOptions.ATTACHED, !getDetachedMode()); configuration.setBoolean(DeploymentOptions.SHUTDOWN_IF_ATTACHED, isShutdownOnAttachedExit()); ConfigUtils.encodeCollectionToConfig(configuration, PipelineOptions.CLASSPATHS, getClasspaths(), URL::toString); SavepointRestoreSettings.toConfiguration(getSavepointRestoreSettings(), configuration); }