use of org.apache.flink.runtime.jobgraph.RestoreMode in project flink by apache.
the class CliFrontendParser method createSavepointRestoreSettings.
public static SavepointRestoreSettings createSavepointRestoreSettings(CommandLine commandLine) {
if (commandLine.hasOption(SAVEPOINT_PATH_OPTION.getOpt())) {
String savepointPath = commandLine.getOptionValue(SAVEPOINT_PATH_OPTION.getOpt());
boolean allowNonRestoredState = commandLine.hasOption(SAVEPOINT_ALLOW_NON_RESTORED_OPTION.getOpt());
final RestoreMode restoreMode;
if (commandLine.hasOption(SAVEPOINT_RESTORE_MODE)) {
restoreMode = ConfigurationUtils.convertValue(commandLine.getOptionValue(SAVEPOINT_RESTORE_MODE), RestoreMode.class);
} else {
restoreMode = SavepointConfigOptions.RESTORE_MODE.defaultValue();
}
return SavepointRestoreSettings.forPath(savepointPath, allowNonRestoredState, restoreMode);
} else {
return SavepointRestoreSettings.none();
}
}
use of org.apache.flink.runtime.jobgraph.RestoreMode 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;
}
Aggregations