Skip to content
Snippets Groups Projects
Commit 6c86f981 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

feature: create summary.csv during download

parent 6e579443
Branches
Tags
No related merge requests found
......@@ -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) {
......
......@@ -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";
......
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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment