You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2018/11/26 21:57:27 UTC

[GitHub] upthewaterspout closed pull request #4: GEODE-6086: Looking for the output files in the correct location

upthewaterspout closed pull request #4: GEODE-6086: Looking for the output files in the correct location
URL: https://github.com/apache/geode-benchmarks/pull/4
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 @@
  *   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 void analyzeTestRun(File testResultDir, File baselineResultDir, Writer ou
       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 void analyzeTestRun(File testResultDir, File baselineResultDir, Writer ou
     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 @@
  * 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 int threads() {
       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 @@
   @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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services