Java Code Examples for org.apache.flink.runtime.util.EnvironmentInformation#getVersion()

The following examples show how to use org.apache.flink.runtime.util.EnvironmentInformation#getVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DashboardConfiguration.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) {

		final String flinkVersion = EnvironmentInformation.getVersion();

		final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation();
		final String flinkRevision;

		if (revision != null) {
			flinkRevision = revision.commitId + " @ " + revision.commitDate;
		} else {
			flinkRevision = "unknown revision";
		}

		return new DashboardConfiguration(
			refreshInterval,
			zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()),
			// convert zone date time into offset in order to not do the day light saving adaptions wrt the offset
			zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000,
			flinkVersion,
			flinkRevision);
	}
 
Example 2
Source File: DashboardConfiguration.java    From flink with Apache License 2.0 6 votes vote down vote up
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) {

		final String flinkVersion = EnvironmentInformation.getVersion();

		final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation();
		final String flinkRevision;

		if (revision != null) {
			flinkRevision = revision.commitId + " @ " + revision.commitDate;
		} else {
			flinkRevision = "unknown revision";
		}

		return new DashboardConfiguration(
			refreshInterval,
			zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()),
			// convert zone date time into offset in order to not do the day light saving adaptions wrt the offset
			zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000,
			flinkVersion,
			flinkRevision);
	}
 
Example 3
Source File: DashboardConfiguration.java    From flink with Apache License 2.0 6 votes vote down vote up
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime, boolean webSubmitEnabled) {

		final String flinkVersion = EnvironmentInformation.getVersion();

		final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation();
		final String flinkRevision;

		if (revision != null) {
			flinkRevision = revision.commitId + " @ " + revision.commitDate;
		} else {
			flinkRevision = "unknown revision";
		}

		return new DashboardConfiguration(
			refreshInterval,
			zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()),
			// convert zone date time into offset in order to not do the day light saving adaptions wrt the offset
			zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000,
			flinkVersion,
			flinkRevision,
			new Features(webSubmitEnabled));
	}
 
Example 4
Source File: CliFrontend.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
/**
 * Parses the command line arguments and starts the requested action.
 *
 * @param args command line arguments of the client.
 * @return The return code of the program
 */
public int parseParameters(String[] args) {

	// check for action
	if (args.length < 1) {
		CliFrontendParser.printHelp(customCommandLines);
		System.out.println("Please specify an action.");
		return 1;
	}

	// get action
	String action = args[0];

	// remove action from parameters
	final String[] params = Arrays.copyOfRange(args, 1, args.length);

	try {
		// do action
		switch (action) {
			case ACTION_RUN:
				run(params);
				return 0;
			case ACTION_LIST:
				list(params);
				return 0;
			case ACTION_INFO:
				info(params);
				return 0;
			case ACTION_CANCEL:
				cancel(params);
				return 0;
			case ACTION_STOP:
				stop(params);
				return 0;
			case ACTION_SAVEPOINT:
				savepoint(params);
				return 0;
			case ACTION_MODIFY:
				modify(params);
				return 0;
			case "-h":
			case "--help":
				CliFrontendParser.printHelp(customCommandLines);
				return 0;
			case "-v":
			case "--version":
				String version = EnvironmentInformation.getVersion();
				String commitID = EnvironmentInformation.getRevisionInformation().commitId;
				System.out.print("Version: " + version);
				System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID);
				return 0;
			default:
				System.out.printf("\"%s\" is not a valid action.\n", action);
				System.out.println();
				System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
				System.out.println();
				System.out.println("Specify the version option (-v or --version) to print Flink version.");
				System.out.println();
				System.out.println("Specify the help option (-h or --help) to get help on the command.");
				return 1;
		}
	} catch (CliArgsException ce) {
		return handleArgException(ce);
	} catch (ProgramParametrizationException ppe) {
		return handleParametrizationException(ppe);
	} catch (ProgramMissingJobException pmje) {
		return handleMissingJobException();
	} catch (Exception e) {
		return handleError(e);
	}
}
 
Example 5
Source File: CliFrontend.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Parses the command line arguments and starts the requested action.
 *
 * @param args command line arguments of the client.
 * @return The return code of the program
 */
public int parseParameters(String[] args) {

	// check for action
	if (args.length < 1) {
		CliFrontendParser.printHelp(customCommandLines);
		System.out.println("Please specify an action.");
		return 1;
	}

	// get action
	String action = args[0];

	// remove action from parameters
	final String[] params = Arrays.copyOfRange(args, 1, args.length);

	try {
		// do action
		switch (action) {
			case ACTION_RUN:
				run(params);
				return 0;
			case ACTION_LIST:
				list(params);
				return 0;
			case ACTION_INFO:
				info(params);
				return 0;
			case ACTION_CANCEL:
				cancel(params);
				return 0;
			case ACTION_STOP:
				stop(params);
				return 0;
			case ACTION_SAVEPOINT:
				savepoint(params);
				return 0;
			case "-h":
			case "--help":
				CliFrontendParser.printHelp(customCommandLines);
				return 0;
			case "-v":
			case "--version":
				String version = EnvironmentInformation.getVersion();
				String commitID = EnvironmentInformation.getRevisionInformation().commitId;
				System.out.print("Version: " + version);
				System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID);
				return 0;
			default:
				System.out.printf("\"%s\" is not a valid action.\n", action);
				System.out.println();
				System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
				System.out.println();
				System.out.println("Specify the version option (-v or --version) to print Flink version.");
				System.out.println();
				System.out.println("Specify the help option (-h or --help) to get help on the command.");
				return 1;
		}
	} catch (CliArgsException ce) {
		return handleArgException(ce);
	} catch (ProgramParametrizationException ppe) {
		return handleParametrizationException(ppe);
	} catch (ProgramMissingJobException pmje) {
		return handleMissingJobException();
	} catch (Exception e) {
		return handleError(e);
	}
}
 
Example 6
Source File: CliFrontend.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Parses the command line arguments and starts the requested action.
 *
 * @param args command line arguments of the client.
 * @return The return code of the program
 */
public int parseParameters(String[] args) {

	// check for action
	if (args.length < 1) {
		CliFrontendParser.printHelp(customCommandLines);
		System.out.println("Please specify an action.");
		return 1;
	}

	// get action
	String action = args[0];

	// remove action from parameters
	final String[] params = Arrays.copyOfRange(args, 1, args.length);

	try {
		// do action
		switch (action) {
			case ACTION_RUN:
				run(params);
				return 0;
			case ACTION_RUN_APPLICATION:
				runApplication(params);
				return 0;
			case ACTION_LIST:
				list(params);
				return 0;
			case ACTION_INFO:
				info(params);
				return 0;
			case ACTION_CANCEL:
				cancel(params);
				return 0;
			case ACTION_STOP:
				stop(params);
				return 0;
			case ACTION_SAVEPOINT:
				savepoint(params);
				return 0;
			case "-h":
			case "--help":
				CliFrontendParser.printHelp(customCommandLines);
				return 0;
			case "-v":
			case "--version":
				String version = EnvironmentInformation.getVersion();
				String commitID = EnvironmentInformation.getRevisionInformation().commitId;
				System.out.print("Version: " + version);
				System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID);
				return 0;
			default:
				System.out.printf("\"%s\" is not a valid action.\n", action);
				System.out.println();
				System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
				System.out.println();
				System.out.println("Specify the version option (-v or --version) to print Flink version.");
				System.out.println();
				System.out.println("Specify the help option (-h or --help) to get help on the command.");
				return 1;
		}
	} catch (CliArgsException ce) {
		return handleArgException(ce);
	} catch (ProgramParametrizationException ppe) {
		return handleParametrizationException(ppe);
	} catch (ProgramMissingJobException pmje) {
		return handleMissingJobException();
	} catch (Exception e) {
		return handleError(e);
	}
}