flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GJL <...@git.apache.org>
Subject [GitHub] flink pull request #5215: [FLINK-8328] [flip6] Move Yarn ApplicationStatus p...
Date Tue, 02 Jan 2018 14:28:55 GMT
Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5215#discussion_r159230885
  
    --- Diff: flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java
---
    @@ -743,6 +690,142 @@ private void logAndSysout(String message) {
     		System.out.println(message);
     	}
     
    +	public static void main(final String[] args) throws Exception {
    +		final FlinkYarnSessionCli cli = new FlinkYarnSessionCli("", ""); // no prefix for the
YARN session
    +
    +		final String configurationDirectory = CliFrontend.getConfigurationDirectoryFromEnv();
    +
    +		final Configuration flinkConfiguration = GlobalConfiguration.loadConfiguration();
    +		SecurityUtils.install(new SecurityConfiguration(flinkConfiguration));
    +		int retCode = SecurityUtils.getInstalledContext().runSecured(new Callable<Integer>()
{
    +			@Override
    +			public Integer call() {
    +				return cli.run(args, flinkConfiguration, configurationDirectory);
    +			}
    +		});
    +		System.exit(retCode);
    +	}
    +
    +	private static void runInteractiveCli(
    +		YarnClusterClient clusterClient,
    +		YarnApplicationStatusMonitor yarnApplicationStatusMonitor,
    +		boolean readConsoleInput) {
    +		try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
    +			boolean continueRepl = true;
    +			int numTaskmanagers = 0;
    +			long unknownStatusSince = System.currentTimeMillis();
    --- End diff --
    
    nit: `System.nanoTime()` should be preferred to measure elapsed time because it does not
depend on wall clock, i.e., it is not affected by the user changing the system's time: https://stackoverflow.com/a/351571
    However, if you use `nanoTime()`, the trick in line `729` with negative `unknownStatusSince`
won't work.


---

Mime
View raw message