use of org.apache.flink.runtime.jobgraph.SavepointRestoreSettings in project flink by apache.
the class StandaloneApplicationClusterConfigurationParserFactoryTest method testSavepointRestoreSettingsParsing.
@Test
public void testSavepointRestoreSettingsParsing() throws FlinkParseException {
final String restorePath = "foobar";
final String[] args = { "-c", confDirPath, "-j", JOB_CLASS_NAME, "-s", restorePath, "-n" };
final StandaloneApplicationClusterConfiguration standaloneApplicationClusterConfiguration = commandLineParser.parse(args);
final SavepointRestoreSettings savepointRestoreSettings = standaloneApplicationClusterConfiguration.getSavepointRestoreSettings();
assertThat(savepointRestoreSettings.restoreSavepoint(), is(true));
assertThat(savepointRestoreSettings.getRestorePath(), is(equalTo(restorePath)));
assertThat(savepointRestoreSettings.allowNonRestoredState(), is(true));
}
use of org.apache.flink.runtime.jobgraph.SavepointRestoreSettings in project flink by apache.
the class JarRunHandler method getSavepointRestoreSettings.
private SavepointRestoreSettings getSavepointRestoreSettings(@Nonnull final HandlerRequest<JarRunRequestBody> request) throws RestHandlerException {
final JarRunRequestBody requestBody = request.getRequestBody();
final boolean allowNonRestoredState = fromRequestBodyOrQueryParameter(requestBody.getAllowNonRestoredState(), () -> getQueryParameter(request, AllowNonRestoredStateQueryParameter.class), false, log);
final String savepointPath = fromRequestBodyOrQueryParameter(emptyToNull(requestBody.getSavepointPath()), () -> emptyToNull(getQueryParameter(request, SavepointPathQueryParameter.class)), null, log);
final RestoreMode restoreMode = Optional.ofNullable(requestBody.getRestoreMode()).orElseGet(SavepointConfigOptions.RESTORE_MODE::defaultValue);
final SavepointRestoreSettings savepointRestoreSettings;
if (savepointPath != null) {
savepointRestoreSettings = SavepointRestoreSettings.forPath(savepointPath, allowNonRestoredState, restoreMode);
} else {
savepointRestoreSettings = SavepointRestoreSettings.none();
}
return savepointRestoreSettings;
}
use of org.apache.flink.runtime.jobgraph.SavepointRestoreSettings in project flink by apache.
the class JarRunHandlerParameterTest method validateDefaultGraph.
@Override
JobGraph validateDefaultGraph() {
JobGraph jobGraph = super.validateDefaultGraph();
final SavepointRestoreSettings savepointRestoreSettings = jobGraph.getSavepointRestoreSettings();
assertFalse(savepointRestoreSettings.allowNonRestoredState());
Assert.assertNull(savepointRestoreSettings.getRestorePath());
return jobGraph;
}
use of org.apache.flink.runtime.jobgraph.SavepointRestoreSettings in project flink by apache.
the class JarRunHandlerParameterTest method validateGraph.
@Override
JobGraph validateGraph() {
JobGraph jobGraph = super.validateGraph();
final SavepointRestoreSettings savepointRestoreSettings = jobGraph.getSavepointRestoreSettings();
Assert.assertTrue(savepointRestoreSettings.allowNonRestoredState());
assertEquals(RESTORE_PATH, savepointRestoreSettings.getRestorePath());
return jobGraph;
}
use of org.apache.flink.runtime.jobgraph.SavepointRestoreSettings in project beam by apache.
the class FlinkSavepointTest method restoreFromSavepointLegacy.
private void restoreFromSavepointLegacy(Pipeline pipeline, String savepointDir) throws ExecutionException, InterruptedException {
JobGraph jobGraph = getJobGraph(pipeline);
SavepointRestoreSettings savepointSettings = SavepointRestoreSettings.forPath(savepointDir);
jobGraph.setSavepointRestoreSettings(savepointSettings);
flinkCluster.submitJob(jobGraph).get();
}
Aggregations