Package org.apache.flink.configuration

Examples of org.apache.flink.configuration.Configuration


  @Test
  public void testGetStatisticsNonExistingFile() {
    try {
      final DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath("file:///some/none/existing/directory/");
      format.configure(new Configuration());
     
      BaseStatistics stats = format.getStatistics(null);
      Assert.assertNull("The file statistics should be null.", stats);
    } catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here


      final long SIZE = 1024 * 500;
      String tempFile = TestFileUtils.createTempFile(SIZE);
     
      final DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
      BaseStatistics stats = format.getStatistics(null);
      Assert.assertEquals("The file size from the statistics is wrong.", SIZE, stats.getTotalInputSize());
    } catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here

     
      String tempDir = TestFileUtils.createTempFileDir(SIZE1, SIZE2, SIZE3);
     
      final DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      BaseStatistics stats = format.getStatistics(null);
      Assert.assertEquals("The file size from the statistics is wrong.", TOTAL, stats.getTotalInputSize());
    } catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here

     
      String tempFile = TestFileUtils.createTempFile(SIZE);
     
      DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
     
      FileBaseStatistics stats = format.getStatistics(null);
      Assert.assertEquals("The file size from the statistics is wrong.", SIZE, stats.getTotalInputSize());
     
      format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
      FileBaseStatistics newStats = format.getStatistics(stats);
      Assert.assertTrue("Statistics object was changed", newStats == stats);

      // insert fake stats with the correct modification time. the call should return the fake stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
      FileBaseStatistics fakeStats = new FileBaseStatistics(stats.getLastModificationTime(), FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics latest = format.getStatistics(fakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", FAKE_SIZE, latest.getTotalInputSize());
     
      // insert fake stats with the expired modification time. the call should return new accurate stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
      FileBaseStatistics outDatedFakeStats = new FileBaseStatistics(stats.getLastModificationTime()-1, FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics reGathered = format.getStatistics(outDatedFakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", SIZE, reGathered.getTotalInputSize());
     
View Full Code Here

     
      String tempDir = TestFileUtils.createTempFileDir(SIZE1, SIZE2, SIZE3);
     
      DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics stats = format.getStatistics(null);
      Assert.assertEquals("The file size from the statistics is wrong.", TOTAL, stats.getTotalInputSize());
     
      format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics newStats = format.getStatistics(stats);
      Assert.assertTrue("Statistics object was changed", newStats == stats);

      // insert fake stats with the correct modification time. the call should return the fake stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics fakeStats = new FileBaseStatistics(stats.getLastModificationTime(), FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics latest = format.getStatistics(fakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", FAKE_SIZE, latest.getTotalInputSize());
     
      // insert fake stats with the correct modification time. the call should return the fake stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics outDatedFakeStats = new FileBaseStatistics(stats.getLastModificationTime()-1, FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics reGathered = format.getStatistics(outDatedFakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", TOTAL, reGathered.getTotalInputSize());
     
View Full Code Here

  public void testFileInputSplit() {
    try {
      String tempFile = TestFileUtils.createTempFileDirExtension(".deflate", "some", "stupid", "meaningless", "files");
      final DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
      FileInputSplit[] splits = format.createInputSplits(2);
      Assert.assertEquals(4, splits.length);
      for(FileInputSplit split : splits) {
        Assert.assertEquals(-1L, split.getLength()); // unsplittable deflate files have this size as a flag for "read whole file"
        Assert.assertEquals(0L, split.getStart()); // always read from the beginning.
      }
     
      // test if this also works for "mixed" directories
      TestFileUtils.createTempFileInDirectory(tempFile.replace("file:", ""), "this creates a test file with a random extension (at least not .deflate)");
     
      final DummyFileInputFormat formatMixed = new DummyFileInputFormat();
      formatMixed.setFilePath(tempFile);
      formatMixed.configure(new Configuration());
      FileInputSplit[] splitsMixed = formatMixed.createInputSplits(2);
      Assert.assertEquals(5, splitsMixed.length);
      for(FileInputSplit split : splitsMixed) {
        if(split.getPath().getName().endsWith(".deflate")) {
          Assert.assertEquals(-1L, split.getLength()); // unsplittable deflate files have this size as a flag for "read whole file"
View Full Code Here

     
      // test that only the valid files are accepted
     
      final DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(f.toURI().toString());
      format.configure(new Configuration());
      FileInputSplit[] splits = format.createInputSplits(1);
     
      Assert.assertEquals(2, splits.length);
     
      final URI uri1 = splits[0].getPath().toUri();
View Full Code Here

    setTaskManagerNumSlots(DOP);
  }

  @Parameters
  public static Collection<Object[]> getConfigurations() {
    Configuration config1 = new Configuration();
    config1.setInteger("testcase", 1);

    Configuration config2 = new Configuration();
    config2.setInteger("testcase", 2);

    Configuration config3 = new Configuration();
    config3.setInteger("testcase", 3);

    Configuration config4 = new Configuration();
    config4.setInteger("testcase", 4);

    return toParameterList(config1, config2, config3, config4);
  }
View Full Code Here

    {
      verticesInputConfig.addOutputShipStrategy(ShipStrategyType.FORWARD);
      verticesInputConfig.setOutputSerializer(serializer);

      // chained mapper that duplicates the id
      TaskConfig chainedMapperConfig = new TaskConfig(new Configuration());
      chainedMapperConfig.setStubWrapper(new UserCodeClassWrapper<IdDuplicator>(IdDuplicator.class));
      chainedMapperConfig.setDriverStrategy(DriverStrategy.COLLECTOR_MAP);
      chainedMapperConfig.setInputLocalStrategy(0, LocalStrategy.NONE);
      chainedMapperConfig.setInputSerializer(serializer, 0);
View Full Code Here

      headConfig.setOutputSerializer(serializer);
      headConfig.addOutputShipStrategy(ShipStrategyType.PARTITION_HASH);
      headConfig.setOutputComparator(comparator, 0);

      // final output
      TaskConfig headFinalOutConfig = new TaskConfig(new Configuration());
      headFinalOutConfig.setOutputSerializer(serializer);
      headFinalOutConfig.addOutputShipStrategy(ShipStrategyType.FORWARD);
      headConfig.setIterationHeadFinalOutputConfig(headFinalOutConfig);

      // the sync
View Full Code Here

TOP

Related Classes of org.apache.flink.configuration.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.