Java Code Examples for org.apache.flink.client.cli.CliFrontend#parseParameters()

The following examples show how to use org.apache.flink.client.cli.CliFrontend#parseParameters() . 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: YarnTestBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
	try {
		int returnValue;
		switch (type) {
			case YARN_SESSION:
				yCli = new FlinkYarnSessionCli(
					configuration,
					configurationDirectory,
					"",
					"",
					true);
				returnValue = yCli.run(args);
				break;
			case CLI_FRONTEND:
				try {
					CliFrontend cli = new CliFrontend(
						configuration,
						CliFrontend.loadCustomCommandLines(configuration, configurationDirectory));
					returnValue = cli.parseParameters(args);
				} catch (Exception e) {
					throw new RuntimeException("Failed to execute the following args with CliFrontend: "
						+ Arrays.toString(args), e);
				}
				break;
			default:
				throw new RuntimeException("Unknown type " + type);
		}

		if (returnValue != this.expectedReturnValue) {
			Assert.fail("The YARN session returned with unexpected value=" + returnValue + " expected=" + expectedReturnValue);
		}
	} catch (Throwable t) {
		LOG.info("Runner stopped with exception", t);
		// save error.
		this.runnerError = t;
	}
}
 
Example 2
Source File: YarnTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
	try {
		int returnValue;
		switch (type) {
			case YARN_SESSION:
				yCli = new FlinkYarnSessionCli(
					configuration,
					configurationDirectory,
					"",
					"",
					true);
				returnValue = yCli.run(args);
				break;
			case CLI_FRONTEND:
				try {
					CliFrontend cli = new CliFrontend(
						configuration,
						CliFrontend.loadCustomCommandLines(configuration, configurationDirectory));
					returnValue = cli.parseParameters(args);
				} catch (Exception e) {
					throw new RuntimeException("Failed to execute the following args with CliFrontend: "
						+ Arrays.toString(args), e);
				}
				break;
			default:
				throw new RuntimeException("Unknown type " + type);
		}

		if (returnValue != this.expectedReturnValue) {
			Assert.fail("The YARN session returned with unexpected value=" + returnValue + " expected=" + expectedReturnValue);
		}
	} catch (Throwable t) {
		LOG.info("Runner stopped with exception", t);
		// save error.
		this.runnerError = t;
	}
}
 
Example 3
Source File: YarnTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
	try {
		int returnValue;
		switch (type) {
			case YARN_SESSION:
				yCli = new FlinkYarnSessionCli(
					configuration,
					configurationDirectory,
					"",
					"",
					true);
				returnValue = yCli.run(args);
				break;
			case CLI_FRONTEND:
				try {
					CliFrontend cli = new CliFrontend(
						configuration,
						CliFrontend.loadCustomCommandLines(configuration, configurationDirectory));
					returnValue = cli.parseParameters(args);
				} catch (Exception e) {
					throw new RuntimeException("Failed to execute the following args with CliFrontend: "
						+ Arrays.toString(args), e);
				}
				break;
			default:
				throw new RuntimeException("Unknown type " + type);
		}

		if (returnValue != this.expectedReturnValue) {
			Assert.fail("The YARN session returned with unexpected value=" + returnValue + " expected=" + expectedReturnValue);
		}
	} catch (Throwable t) {
		LOG.info("Runner stopped with exception", t);
		// save error.
		this.runnerError = t;
	}
}