Пример #1
0
  @Test
  public void testCorrectSettingOfMaxSlots() throws Exception {

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

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

    RunOptions runOptions = CliFrontendParser.parseRunCommand(params);

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

    AbstractYarnClusterDescriptor descriptor =
        yarnCLI.createDescriptor("", runOptions.getCommandLine());

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

    Configuration config = new Configuration();
    CliFrontend.setJobManagerAddressInConfig(config, new InetSocketAddress("test", 9000));
    ClusterClient client = new TestingYarnClusterClient(descriptor, config);
    Assert.assertEquals(6, client.getMaxSlots());
  }
Пример #2
0
  @Test
  public void testNotEnoughTaskSlots() throws Exception {

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

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

    RunOptions runOptions = CliFrontendParser.parseRunCommand(params);

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

    AbstractYarnClusterDescriptor descriptor =
        yarnCLI.createDescriptor("", runOptions.getCommandLine());

    // each task manager has 3 slots but the parallelism is 7. Thus the slots should be increased.
    Assert.assertEquals(4, descriptor.getTaskManagerSlots());
    Assert.assertEquals(2, descriptor.getTaskManagerCount());
  }