flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
/**
	 * Executes the info action.
	 *
	 * @param args Command line arguments for the info action.
	 */
Executes the info action.
@param args Command line arguments for the info action.
Executes the info action . @param args Command line arguments for the info action .
protected int info(String[] args) {
		LOG.info("Running 'info' command.");
		InfoOptions options;
		try {
			options = CliFrontendParser.parseInfoCommand(args);
		}
		catch (CliArgsException e) {
			return handleArgException(e);
		}
		catch (Throwable t) {
			return handleError(t);
		}
		if (options.isPrintHelp()) {
			CliFrontendParser.printHelpForInfo();
			return 0;
		}
		if (options.getJarFilePath() == null) {
			return handleArgException(new CliArgsException("The program JAR file was not specified."));
		}
		PackagedProgram program;
		try {
			LOG.info("Building program from JAR file");
			program = buildProgram(options);
		}
		catch (Throwable t) {
			return handleError(t);
		}
		try {
			int parallelism = options.getParallelism();
			if (ExecutionConfig.PARALLELISM_DEFAULT == parallelism) {
				parallelism = defaultParallelism;
			}
			LOG.info("Creating program plan dump");
			Optimizer compiler = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), config);
			FlinkPlan flinkPlan = ClusterClient.getOptimizedPlan(compiler, program, parallelism);
			String jsonPlan = null;
			if (flinkPlan instanceof OptimizedPlan) {
				jsonPlan = new PlanJSONDumpGenerator().getOptimizerPlanAsJSON((OptimizedPlan) flinkPlan);
			} else if (flinkPlan instanceof StreamingPlan) {
				jsonPlan = ((StreamingPlan) flinkPlan).getStreamingPlanAsJSON();
			}
			if (jsonPlan != null) {
				System.out.println("----------------------- Execution Plan -----------------------");
				System.out.println(jsonPlan);
				System.out.println("--------------------------------------------------------------");
			}
			else {
				System.out.println("JSON plan could not be generated.");
			}
			String description = program.getDescription();
			if (description != null) {
				System.out.println();
				System.out.println(description);
			}
			else {
				System.out.println();
				System.out.println("No description provided.");
			}
			return 0;
		}
		catch (Throwable t) {
			return handleError(t);
		}
		finally {
			program.deleteExtractedLibraries();
		}
	}
protected int info ( String [ ] args ) { LOG . info ( "Running 'info' command." ) ; InfoOptions options ; try { options = CliFrontendParser . parseInfoCommand ( args ) ; } catch ( CliArgsException e ) { return handleArgException ( e ) ; } catch ( Throwable t ) { return handleError ( t ) ; } if ( options . isPrintHelp ( ) ) { CliFrontendParser . printHelpForInfo ( ) ; return 0 ; } if ( options . getJarFilePath ( ) == null ) { return handleArgException ( new CliArgsException ( "The program JAR file was not specified." ) ) ; } PackagedProgram program ; try { LOG . info ( "Building program from JAR file" ) ; program = buildProgram ( options ) ; } catch ( Throwable t ) { return handleError ( t ) ; } try { int parallelism = options . getParallelism ( ) ; if ( ExecutionConfig . PARALLELISM_DEFAULT == parallelism ) { parallelism = defaultParallelism ; } LOG . info ( "Creating program plan dump" ) ; Optimizer compiler = new Optimizer ( new DataStatistics ( ) , new DefaultCostEstimator ( ) , config ) ; FlinkPlan flinkPlan = ClusterClient . getOptimizedPlan ( compiler , program , parallelism ) ; String jsonPlan = null ; if ( flinkPlan instanceof OptimizedPlan ) { jsonPlan = new PlanJSONDumpGenerator ( ) . getOptimizerPlanAsJSON ( ( OptimizedPlan ) flinkPlan ) ; } else if ( flinkPlan instanceof StreamingPlan ) { jsonPlan = ( ( StreamingPlan ) flinkPlan ) . getStreamingPlanAsJSON ( ) ; } if ( jsonPlan != null ) { System . out . println ( "----------------------- Execution Plan -----------------------" ) ; System . out . println ( jsonPlan ) ; System . out . println ( "--------------------------------------------------------------" ) ; } else { System . out . println ( "JSON plan could not be generated." ) ; } String description = program . getDescription ( ) ; if ( description != null ) { System . out . println ( ) ; System . out . println ( description ) ; } else { System . out . println ( ) ; System . out . println ( "No description provided." ) ; } return 0 ; } catch ( Throwable t ) { return handleError ( t ) ; } finally { program . deleteExtractedLibraries ( ) ; } }
Executes the info action.
Executes the info action .
// Parse command line options // evaluate help flag // -------- build the packaged program -------------