You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2018/11/26 21:57:29 UTC

[geode-benchmarks] branch develop updated: GEODE-6086: Looking for the output files in the correct location

This is an automated email from the ASF dual-hosted git repository.

upthewaterspout pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git


The following commit(s) were added to refs/heads/develop by this push:
     new 27ce719  GEODE-6086: Looking for the output files in the correct location
27ce719 is described below

commit 27ce7198f9fd200e5c6fc12fb6e1af90462d7cb1
Author: Dan Smith <ds...@pivotal.io>
AuthorDate: Mon Nov 26 13:57:25 2018 -0800

    GEODE-6086: Looking for the output files in the correct location
    
    GEODE-6086: Looking for the output files in the correct location
    
    Yardstick creates a subdirectory, so find the files in that directory
---
 .../perftest/analysis/BenchmarkRunAnalyzer.java    | 29 +++++++++++++++++++---
 .../geode/perftest/yardstick/YardstickTask.java    |  6 +++++
 .../analysis/BenchmarkRunAnalyzerTest.java         | 16 ++++++------
 3 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/harness/src/main/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzer.java b/harness/src/main/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzer.java
index c095876..c84346b 100644
--- a/harness/src/main/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzer.java
+++ b/harness/src/main/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzer.java
@@ -15,12 +15,16 @@
 package org.apache.geode.perftest.analysis;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.Writer;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.geode.perftest.yardstick.YardstickTask;
+
 /**
  * Analyzer that takes in benchmarks, probes, and result directories and produces
  * a comparison of the results to a provided writer.
@@ -30,9 +34,11 @@ import java.util.List;
  *   Result1
  *     /BenchmarkA
  *       /client1
- *         /Probe1.csv
+ *         /20181121-111354-yardstick-output
+ *           /Probe1.csv
  *       /client2
- *         /Probe2.csv
+ *         /20181121-111354-yardstick-output
+ *           /Probe1.csv
  *     /BenchmarkB
  *         ...
  * </pre>
@@ -65,13 +71,13 @@ public class BenchmarkRunAnalyzer {
       for (ProbeResultParser probe : probes) {
         stream.println(probe.getResultDescription());
         for (String node : benchmark.nodesToParse) {
-          probe.parseResults(new File(new File(testResultDir, benchmark.benchmarkSubdirectory), node));
+          probe.parseResults(getBenchmarkOutputDir(testResultDir, benchmark, node));
         }
         double testResult = probe.getProbeResult();
         stream.println("Result: " + String.valueOf(testResult));
         probe.reset();
         for (String node : benchmark.nodesToParse) {
-          probe.parseResults(new File(new File(baselineResultDir, benchmark.benchmarkSubdirectory), node));
+          probe.parseResults(getBenchmarkOutputDir(baselineResultDir, benchmark, node));
         }
         double baselineResult = probe.getProbeResult();
         stream.println("Baseline: " + String.valueOf(baselineResult));
@@ -83,6 +89,21 @@ public class BenchmarkRunAnalyzer {
     stream.flush();
   }
 
+  private File getBenchmarkOutputDir(File testResultDir, SensorData benchmark,
+                                     String node) {
+    File benchmarkDir = new File(testResultDir, benchmark.benchmarkSubdirectory);
+    File nodeDir = new File(benchmarkDir, node);
+
+    File[] files = nodeDir.listFiles((dir, name) -> name.contains(YardstickTask.YARDSTICK_OUTPUT));
+
+    if(files == null || files.length != 1) {
+      throw new IllegalStateException("Expected at least one subdirectory in " + nodeDir
+          + " with the name *"  +YardstickTask.YARDSTICK_OUTPUT);
+    }
+
+    return files[0];
+  }
+
   // TODO: depending on how run output is stored, this data may be excessive or insufficient
   // The present assumption is each benchmark contains an arbitrarily named result directory
   // containing subdirectories for each node.  Those subdirectories then contain the probe output
diff --git a/harness/src/main/java/org/apache/geode/perftest/yardstick/YardstickTask.java b/harness/src/main/java/org/apache/geode/perftest/yardstick/YardstickTask.java
index 9046327..6c8cb7b 100644
--- a/harness/src/main/java/org/apache/geode/perftest/yardstick/YardstickTask.java
+++ b/harness/src/main/java/org/apache/geode/perftest/yardstick/YardstickTask.java
@@ -41,6 +41,7 @@ import org.apache.geode.perftest.WorkloadConfig;
  * is executed, it will use yardstick to run an measure the driver.
  */
 public class YardstickTask implements Task {
+  public static final String YARDSTICK_OUTPUT = "-yardstick-output";
   private final BenchmarkDriver benchmark;
   private WorkloadConfig workloadConfig;
 
@@ -77,6 +78,11 @@ public class YardstickTask implements Task {
       public String outputFolder() {
         return context.getOutputDir().getAbsolutePath();
       }
+
+      @Override
+      public String defaultDescription() {
+        return YARDSTICK_OUTPUT;
+      }
     };
     cfg.output(System.out);
 
diff --git a/harness/src/test/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzerTest.java b/harness/src/test/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzerTest.java
index 1911c0c..387c198 100644
--- a/harness/src/test/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzerTest.java
+++ b/harness/src/test/java/org/apache/geode/perftest/analysis/BenchmarkRunAnalyzerTest.java
@@ -43,15 +43,15 @@ public class BenchmarkRunAnalyzerTest {
   @Test
   public void verifyResultHarvester() throws IOException {
     final File testFolder = temporaryFolder.newFolder("testFolder");
-    final File testBenchmarkA1 = temporaryFolder.newFolder("testFolder","BenchmarkA","client1");
-    final File testBenchmarkA2 = temporaryFolder.newFolder("testFolder","BenchmarkA","client2");
-    final File testBenchmarkB1 = temporaryFolder.newFolder("testFolder","BenchmarkB","client1");
-    final File testBenchmarkB2 = temporaryFolder.newFolder("testFolder","BenchmarkB","client2");
+    final File testBenchmarkA1 = temporaryFolder.newFolder("testFolder","BenchmarkA","client1", "20181121-111516-yardstick-output");
+    final File testBenchmarkA2 = temporaryFolder.newFolder("testFolder","BenchmarkA","client2", "20181121-111516-yardstick-output");
+    final File testBenchmarkB1 = temporaryFolder.newFolder("testFolder","BenchmarkB","client1", "20181121-111516-yardstick-output");
+    final File testBenchmarkB2 = temporaryFolder.newFolder("testFolder","BenchmarkB","client2", "20181121-111516-yardstick-output");
     final File baseFolder = temporaryFolder.newFolder("baseFolder");
-    final File baseBenchmarkA1 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client1");
-    final File baseBenchmarkA2 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client2");
-    final File baseBenchmarkB1 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client1");
-    final File baseBenchmarkB2 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client2");
+    final File baseBenchmarkA1 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client1", "20181121-111516-yardstick-output");
+    final File baseBenchmarkA2 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client2", "20181121-111516-yardstick-output");
+    final File baseBenchmarkB1 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client1", "20181121-111516-yardstick-output");
+    final File baseBenchmarkB2 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client2", "20181121-111516-yardstick-output");
 
     populateThroughputCSV(testBenchmarkA1, new double[] {10, 15, 20, 25, 30});  // Avg 20
     populatePercentileCSV(testBenchmarkA1, new double[] {0, 0, 99, 1});         // 200