當前位置: 首頁>>代碼示例>>Java>>正文


Java FlinkYarnSessionCli.addRunOptions方法代碼示例

本文整理匯總了Java中org.apache.flink.yarn.cli.FlinkYarnSessionCli.addRunOptions方法的典型用法代碼示例。如果您正苦於以下問題:Java FlinkYarnSessionCli.addRunOptions方法的具體用法?Java FlinkYarnSessionCli.addRunOptions怎麽用?Java FlinkYarnSessionCli.addRunOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.flink.yarn.cli.FlinkYarnSessionCli的用法示例。


在下文中一共展示了FlinkYarnSessionCli.addRunOptions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testNotEnoughTaskSlots

import org.apache.flink.yarn.cli.FlinkYarnSessionCli; //導入方法依賴的package包/類
@Test
public void testNotEnoughTaskSlots() throws Exception {
	String[] params =
		new String[] {"-yn", "2", "-ys", "3", "-p", "7"};

	FlinkYarnSessionCli yarnCLI = new FlinkYarnSessionCli(
		new Configuration(),
		tmp.getRoot().getAbsolutePath(),
		"y",
		"yarn");

	Options options = new Options();
	// TODO: Nasty workaround: We should get rid of the YarnCLI and run options coupling
	options.addOption(CliFrontendParser.PARALLELISM_OPTION);
	yarnCLI.addGeneralOptions(options);
	yarnCLI.addRunOptions(options);

	final CommandLine commandLine = CliFrontendParser.parse(options, params, true);

	ClusterSpecification clusterSpecification = yarnCLI.getClusterSpecification(commandLine);

	// each task manager has 3 slots but the parallelism is 7. Thus the slots should be increased.
	assertEquals(4, clusterSpecification.getSlotsPerTaskManager());
	assertEquals(2, clusterSpecification.getNumberTaskManagers());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:26,代碼來源:FlinkYarnSessionCliTest.java

示例2: testDynamicProperties

import org.apache.flink.yarn.cli.FlinkYarnSessionCli; //導入方法依賴的package包/類
@Test
public void testDynamicProperties() throws Exception {

	FlinkYarnSessionCli cli = new FlinkYarnSessionCli(
		new Configuration(),
		tmp.getRoot().getAbsolutePath(),
		"",
		"",
		false);
	Options options = new Options();
	cli.addGeneralOptions(options);
	cli.addRunOptions(options);

	CommandLineParser parser = new DefaultParser();
	CommandLine cmd = parser.parse(options, new String[]{"run", "-j", "fake.jar", "-n", "15",
			"-D", "akka.ask.timeout=5 min", "-D", "env.java.opts=-DappName=foobar"});

	AbstractYarnClusterDescriptor flinkYarnDescriptor = cli.createClusterDescriptor(cmd);

	Assert.assertNotNull(flinkYarnDescriptor);

	Map<String, String> dynProperties =
		FlinkYarnSessionCli.getDynamicProperties(flinkYarnDescriptor.getDynamicPropertiesEncoded());
	assertEquals(2, dynProperties.size());
	assertEquals("5 min", dynProperties.get("akka.ask.timeout"));
	assertEquals("-DappName=foobar", dynProperties.get("env.java.opts"));
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:28,代碼來源:FlinkYarnSessionCliTest.java

示例3: testDynamicProperties

import org.apache.flink.yarn.cli.FlinkYarnSessionCli; //導入方法依賴的package包/類
@Test
public void testDynamicProperties() throws Exception {

	FlinkYarnSessionCli cli = new FlinkYarnSessionCli(
		"",
		"",
		false);
	Options options = new Options();
	cli.addGeneralOptions(options);
	cli.addRunOptions(options);

	CommandLineParser parser = new DefaultParser();
	CommandLine cmd = parser.parse(options, new String[]{"run", "-j", "fake.jar", "-n", "15",
			"-D", "akka.ask.timeout=5 min", "-D", "env.java.opts=-DappName=foobar"});

	AbstractYarnClusterDescriptor flinkYarnDescriptor = cli.createDescriptor(
		new Configuration(),
		tmp.getRoot().getAbsolutePath(),
		null,
		cmd);

	Assert.assertNotNull(flinkYarnDescriptor);

	Map<String, String> dynProperties =
		FlinkYarnSessionCli.getDynamicProperties(flinkYarnDescriptor.getDynamicPropertiesEncoded());
	Assert.assertEquals(2, dynProperties.size());
	Assert.assertEquals("5 min", dynProperties.get("akka.ask.timeout"));
	Assert.assertEquals("-DappName=foobar", dynProperties.get("env.java.opts"));
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:30,代碼來源:FlinkYarnSessionCliTest.java


注:本文中的org.apache.flink.yarn.cli.FlinkYarnSessionCli.addRunOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。