wangyang0918 commented on a change in pull request #10245:
[FLINK-10936][kubernetes] Implement Kubernetes command line tools to support
session cluster.
URL: https://github.com/apache/flink/pull/10245#discussion_r355171293
##########
File path:
flink-clients/src/main/java/org/apache/flink/client/cli/AbstractCustomCommandLine.java
##########
@@ -89,4 +96,80 @@ public Configuration
applyCommandLineOptionsToConfiguration(CommandLine commandL
return resultingConfiguration;
}
+
+ protected void printUsage() {
+ System.out.println("Usage:");
+ HelpFormatter formatter = new HelpFormatter();
+ formatter.setWidth(200);
+ formatter.setLeftPadding(5);
+
+ formatter.setSyntaxPrefix(" Optional");
+ Options options = new Options();
+ addGeneralOptions(options);
+ addRunOptions(options);
+ formatter.printHelp(" ", options);
+ }
+
+ protected static int handleCliArgsException(CliArgsException e) {
+ LOG.error("Could not parse the command line arguments.", e);
+
+ System.out.println(e.getMessage());
+ System.out.println();
+ System.out.println("Use the help option (-h or --help) to get
help on the command.");
+ return 1;
+ }
+
+ protected static int handleError(Throwable t) {
+ LOG.error("Error while running the Flink session.", t);
+
+ System.err.println();
+
System.err.println("------------------------------------------------------------");
+ System.err.println(" The program finished with the following
exception:");
+ System.err.println();
+
+ t.printStackTrace();
+ return 1;
+ }
+
+ /**
+ * Read-Evaluate-Print step for the REPL.
+ *
+ * @param in to read from
+ * @param readConsoleInput true if console input has to be read
+ * @param clientPollingIntervalMs wait until clientPollingIntervalMs is
over or the user entered something.
+ * @param helpMessage help message
+ * @return true if the REPL shall be continued, otherwise false
+ */
+ protected static boolean repStep(
+ BufferedReader in,
+ boolean readConsoleInput,
+ long clientPollingIntervalMs,
+ String helpMessage) throws IOException, InterruptedException {
+
+ long startTime = System.currentTimeMillis();
+ while ((System.currentTimeMillis() - startTime) <
clientPollingIntervalMs
Review comment:
`CLIENT_POLLING_INTERVAL_MS ` could be moved into the
`AbstractCustomCommandLine` so that it could be used for all clients.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services