Skip to content

Instantly share code, notes, and snippets.

@steveloughran
Created January 22, 2019 11:01
Show Gist options
  • Save steveloughran/774a8cb81aeabc86a32db16a654ef63c to your computer and use it in GitHub Desktop.
Save steveloughran/774a8cb81aeabc86a32db16a654ef63c to your computer and use it in GitHub Desktop.
@Test
public void test_140_teracomplete() throws Throwable {
terasortDuration.get().close();
final StringBuilder results = new StringBuilder();
results.append("\"Operation\"\t\"Duration\"\n");
// this is how you dynamically create a function in a method
// for use afterwards.
// Works because there's no IOEs being raised in this sequence.
BiConsumer<String, Optional<DurationInfo>> stage =
(s, od) ->
results.append(String.format("\"%s\"\t\"%s\"\n",
s,
od.map(DurationInfo::getDurationString).orElse("")));
stage.accept("Generate", teragenStageDuration);
stage.accept("Terasort", terasortStageDuration);
stage.accept("Validate", teravalidateStageDuration);
stage.accept("Completed", terasortDuration);
String text = results.toString();
Path path = new Path(terasortPath, "results.csv");
LOG.info("Results are in {}\n{}", path, text);
ContractTestUtils.writeTextFile(getFileSystem(), path, text, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment