use of org.apache.flink.client.cli.SavepointOptions in project flink by apache.
the class CliFrontend method savepoint.
/**
* Executes the SAVEPOINT action.
*
* @param args Command line arguments for the cancel action.
*/
protected int savepoint(String[] args) {
LOG.info("Running 'savepoint' command.");
SavepointOptions options;
try {
options = CliFrontendParser.parseSavepointCommand(args);
} catch (CliArgsException e) {
return handleArgException(e);
} catch (Throwable t) {
return handleError(t);
}
// evaluate help flag
if (options.isPrintHelp()) {
CliFrontendParser.printHelpForSavepoint();
return 0;
}
if (options.isDispose()) {
// Discard
return disposeSavepoint(options);
} else {
// Trigger
String[] cleanedArgs = options.getArgs();
JobID jobId;
if (cleanedArgs.length >= 1) {
String jobIdString = cleanedArgs[0];
try {
jobId = new JobID(StringUtils.hexStringToByte(jobIdString));
} catch (Exception e) {
return handleArgException(new IllegalArgumentException("Error: The value for the Job ID is not a valid ID."));
}
} else {
return handleArgException(new IllegalArgumentException("Error: The value for the Job ID is not a valid ID. " + "Specify a Job ID to trigger a savepoint."));
}
String savepointDirectory = null;
if (cleanedArgs.length >= 2) {
savepointDirectory = cleanedArgs[1];
}
// Print superfluous arguments
if (cleanedArgs.length >= 3) {
logAndSysout("Provided more arguments than required. Ignoring not needed arguments.");
}
return triggerSavepoint(options, jobId, savepointDirectory);
}
}
Aggregations