Package org.apache.flink.client.cli
Class CliFrontend
- java.lang.Object
-
- org.apache.flink.client.cli.CliFrontend
-
public class CliFrontend extends Object
Implementation of a simple command line frontend for executing programs.
-
-
Constructor Summary
Constructors Constructor Description CliFrontend(Configuration configuration, List<CustomCommandLine> customCommandLines)
CliFrontend(Configuration configuration, ClusterClientServiceLoader clusterClientServiceLoader, List<CustomCommandLine> customCommandLines)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
cancel(String[] args)
Executes the CANCEL action.protected void
checkpoint(String[] args)
Executes the CHECKPOINT action.protected void
executeProgram(Configuration configuration, PackagedProgram program)
org.apache.commons.cli.CommandLine
getCommandLine(org.apache.commons.cli.Options commandOptions, String[] args, boolean stopAtNonOptions)
Configuration
getConfiguration()
Getter which returns a copy of the associated configuration.static String
getConfigurationDirectoryFromEnv()
org.apache.commons.cli.Options
getCustomCommandLineOptions()
protected void
info(String[] args)
Executes the info action.protected boolean
isDeploymentTargetApplication(CustomCommandLine activeCustomCommandLine, org.apache.commons.cli.CommandLine commandLine)
protected void
list(String[] args)
Executes the list action.static List<CustomCommandLine>
loadCustomCommandLines(Configuration configuration, String configurationDirectory)
static void
main(String[] args)
Submits the job based on the arguments.int
parseAndRun(String[] args)
Parses the command line arguments and starts the requested action.protected void
run(String[] args)
Executions the run action.protected void
savepoint(String[] args)
Executes the SAVEPOINT action.protected void
stop(String[] args)
Executes the STOP action.CustomCommandLine
validateAndGetActiveCommandLine(org.apache.commons.cli.CommandLine commandLine)
Gets the custom command-line for the arguments.
-
-
-
Constructor Detail
-
CliFrontend
public CliFrontend(Configuration configuration, List<CustomCommandLine> customCommandLines)
-
CliFrontend
public CliFrontend(Configuration configuration, ClusterClientServiceLoader clusterClientServiceLoader, List<CustomCommandLine> customCommandLines)
-
-
Method Detail
-
getConfiguration
public Configuration getConfiguration()
Getter which returns a copy of the associated configuration.- Returns:
- Copy of the associated configuration
-
getCustomCommandLineOptions
public org.apache.commons.cli.Options getCustomCommandLineOptions()
-
run
protected void run(String[] args) throws Exception
Executions the run action.- Parameters:
args
- Command line arguments for the run action.- Throws:
Exception
-
isDeploymentTargetApplication
protected boolean isDeploymentTargetApplication(CustomCommandLine activeCustomCommandLine, org.apache.commons.cli.CommandLine commandLine) throws FlinkException
- Throws:
FlinkException
-
info
protected void info(String[] args) throws Exception
Executes the info action.- Parameters:
args
- Command line arguments for the info action.- Throws:
Exception
-
list
protected void list(String[] args) throws Exception
Executes the list action.- Parameters:
args
- Command line arguments for the list action.- Throws:
Exception
-
stop
protected void stop(String[] args) throws Exception
Executes the STOP action.- Parameters:
args
- Command line arguments for the stop action.- Throws:
Exception
-
cancel
protected void cancel(String[] args) throws Exception
Executes the CANCEL action.- Parameters:
args
- Command line arguments for the cancel action.- Throws:
Exception
-
getCommandLine
public org.apache.commons.cli.CommandLine getCommandLine(org.apache.commons.cli.Options commandOptions, String[] args, boolean stopAtNonOptions) throws CliArgsException
- Throws:
CliArgsException
-
savepoint
protected void savepoint(String[] args) throws Exception
Executes the SAVEPOINT action.- Parameters:
args
- Command line arguments for the savepoint action.- Throws:
Exception
-
checkpoint
protected void checkpoint(String[] args) throws Exception
Executes the CHECKPOINT action.- Parameters:
args
- Command line arguments for the checkpoint action.- Throws:
Exception
-
executeProgram
protected void executeProgram(Configuration configuration, PackagedProgram program) throws ProgramInvocationException
- Throws:
ProgramInvocationException
-
parseAndRun
public int parseAndRun(String[] args)
Parses the command line arguments and starts the requested action.- Parameters:
args
- command line arguments of the client.- Returns:
- The return code of the program
-
main
public static void main(String[] args)
Submits the job based on the arguments.
-
getConfigurationDirectoryFromEnv
public static String getConfigurationDirectoryFromEnv()
-
loadCustomCommandLines
public static List<CustomCommandLine> loadCustomCommandLines(Configuration configuration, String configurationDirectory)
-
validateAndGetActiveCommandLine
public CustomCommandLine validateAndGetActiveCommandLine(org.apache.commons.cli.CommandLine commandLine)
Gets the custom command-line for the arguments.- Parameters:
commandLine
- The input to the command-line.- Returns:
- custom command-line which is active (may only be one at a time)
-
-