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


Java FlinkYarnSessionCli.createDescriptor方法代碼示例

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


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

示例1: testZookeeperNamespaceProperty

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

	File confFile = tmp.newFile("flink-conf.yaml");
	File jarFile = tmp.newFile("test.jar");
	CliFrontend cliFrontend = new CliFrontend(tmp.getRoot().getAbsolutePath());
	final Configuration configuration = cliFrontend.getConfiguration();

	String zkNamespaceCliInput = "flink_test_namespace";

	String[] params =
			new String[] {"-yn", "2", "-yz", zkNamespaceCliInput, jarFile.getAbsolutePath()};

	RunOptions runOptions = CliFrontendParser.parseRunCommand(params);

	FlinkYarnSessionCli yarnCLI = new TestCLI("y", "yarn");
	AbstractYarnClusterDescriptor descriptor = yarnCLI.createDescriptor(
		configuration,
		tmp.getRoot().getAbsolutePath(),
		"",
		runOptions.getCommandLine());

	Assert.assertEquals(zkNamespaceCliInput, descriptor.getZookeeperNamespace());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:25,代碼來源:FlinkYarnSessionCliTest.java

示例2: 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

示例3: testCorrectSettingOfMaxSlots

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

	File confFile = tmp.newFile("flink-conf.yaml");
	File jarFile = tmp.newFile("test.jar");
	CliFrontend cliFrontend = new CliFrontend(tmp.getRoot().getAbsolutePath());

	final Configuration config = cliFrontend.getConfiguration();

	String[] params =
		new String[] {"-yn", "2", "-ys", "3", jarFile.getAbsolutePath()};

	RunOptions runOptions = CliFrontendParser.parseRunCommand(params);

	FlinkYarnSessionCli yarnCLI = new TestCLI("y", "yarn");

	final Configuration configuration = new Configuration();

	AbstractYarnClusterDescriptor descriptor = yarnCLI.createDescriptor(
		configuration,
		tmp.getRoot().getAbsolutePath(),
		"",
		runOptions.getCommandLine());

	final ClusterSpecification clusterSpecification = yarnCLI.createClusterSpecification(
		configuration,
		runOptions.getCommandLine());

	// each task manager has 3 slots but the parallelism is 7. Thus the slots should be increased.
	Assert.assertEquals(3, clusterSpecification.getSlotsPerTaskManager());
	Assert.assertEquals(2, clusterSpecification.getNumberTaskManagers());

	CliFrontend.setJobManagerAddressInConfig(config, new InetSocketAddress("localhost", 9000));
	ClusterClient client = new TestingYarnClusterClient(
		descriptor,
		clusterSpecification.getNumberTaskManagers(),
		clusterSpecification.getSlotsPerTaskManager(),
		config);
	Assert.assertEquals(6, client.getMaxSlots());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:41,代碼來源:FlinkYarnSessionCliTest.java


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