diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java index 79bd6a5787a4d714c10bff92171ccfb92b8f12b4..e31785c78b89cd7a8c94fa4e05ec9b1f22c56548 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java @@ -73,10 +73,6 @@ public class BenchmarkJobManager implements Closeable { private final Job job; - public boolean isUseDemoData() { - return job.isUseDemoData(); - } - private final List<Task> tasks; private final List<BenchmarkError> nonTaskSpecificErrors; private final SPIMComputationAccessor computationAccessor; @@ -94,7 +90,8 @@ public class BenchmarkJobManager implements Closeable { } public void setDownloadNotifier(Progress progress) { - job.setDownloadNotifier(downloadNotifier = convertTo(progress)); + job.setDownloadNotifier(downloadNotifier = + createDownloadNotifierProcessingResultCSV(convertTo(progress))); } public void setUploadNotifier(Progress progress) { @@ -168,6 +165,10 @@ public class BenchmarkJobManager implements Closeable { return getStringFromTimeSafely(job.getEndTime()); } + public boolean isUseDemoData() { + return job.isUseDemoData(); + } + @Override public int hashCode() { return Long.hashCode(job.getId()); @@ -528,6 +529,12 @@ public class BenchmarkJobManager implements Closeable { return Stream.concat(nonTaskSpecificErrors.stream(), taskSpecificErrors).collect(Collectors.toList()); } + private ProgressNotifier createDownloadNotifierProcessingResultCSV( + ProgressNotifier progressNotifier) + { + if (progressNotifier == null) return null; + return new DownloadNotifierProcessingResultCSV(progressNotifier, this); + } } public BenchmarkJobManager(BenchmarkSPIMParameters params) { diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/Constants.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/Constants.java index eebc7e1a22fb06492f2f89617b48ca403b0daa46..6668af6522f4869150f0a100c9c5b00d664ad913 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/Constants.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/Constants.java @@ -55,6 +55,7 @@ public interface Constants { String STATISTICS_RESOURCES_CPU_PERCENTAGE = "resources_used.cpupercent"; String STATISTICS_RESOURCES_START_TIME = "stime"; + String BENCHMARK_RESULT_FILE = "benchmark_result.csv"; String STATISTICS_SUMMARY_FILENAME = "summary.csv"; String SUMMARY_FILE_HEADER = "Task;AvgMemoryUsage;AvgWallTime;MaxWallTime;TotalTime;JobCount"; String DONE_TASK = "done"; diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/DownloadNotifierProcessingResultCSV.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/DownloadNotifierProcessingResultCSV.java new file mode 100644 index 0000000000000000000000000000000000000000..7fd6925647f2e79757e37f39f9d4a69f94688bc4 --- /dev/null +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/DownloadNotifierProcessingResultCSV.java @@ -0,0 +1,62 @@ + +package cz.it4i.fiji.haas_spim_benchmark.core; + +import java.nio.file.Path; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import cz.it4i.fiji.haas_java_client.ProgressNotifier; +import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; + +class DownloadNotifierProcessingResultCSV implements ProgressNotifier { + + public static final Logger log = LoggerFactory.getLogger( + cz.it4i.fiji.haas_spim_benchmark.core.DownloadNotifierProcessingResultCSV.class); + + private final ProgressNotifier decorated; + + private final BenchmarkJob job; + + public DownloadNotifierProcessingResultCSV(final ProgressNotifier decorated, + final BenchmarkJob job) + { + this.decorated = decorated; + this.job = job; + } + + @Override + public void setTitle(final String title) { + decorated.setTitle(title); + } + + @Override + public void setCount(final int count, final int total) { + decorated.setCount(count, total); + } + + @Override + public void addItem(final Object item) { + decorated.addItem(item); + } + + @Override + public void setItemCount(final int count, final int total) { + decorated.setItemCount(count, total); + } + + @Override + public void itemDone(final Object item) { + if (item instanceof String && ((String)item).endsWith(Constants.BENCHMARK_RESULT_FILE)) { + final Path resultFile = job.getDirectory().resolve(Constants.BENCHMARK_RESULT_FILE); + if (resultFile != null) BenchmarkJobManager.formatResultFile(resultFile); + } + decorated.itemDone(item); + } + + @Override + public void done() { + decorated.done(); + } + +}