本文整理汇总了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());
}
示例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"));
}
示例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"));
}