diff --git a/benchmark-collector/src/it4i/fiji/benchmark_extractor/Extractor.java b/benchmark-collector/src/it4i/fiji/benchmark_extractor/Extractor.java index 2354ccec7a66c5a046427ce058ff326c350d9d96..55c3c4739c4c5ad4d15cfae8a5c3d08b5d43c2bb 100644 --- a/benchmark-collector/src/it4i/fiji/benchmark_extractor/Extractor.java +++ b/benchmark-collector/src/it4i/fiji/benchmark_extractor/Extractor.java @@ -7,8 +7,6 @@ import java.io.PrintWriter; import java.nio.file.Files; import java.nio.file.Path; import java.time.Duration; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -29,7 +27,8 @@ public class Extractor { private Map<String, String> valueWithTypes; - public Extractor(Path inputFile, Set<String> valuesToExport, Map<String, String> valuesWithTypes, OutputStream out) { + public Extractor(Path inputFile, Set<String> valuesToExport, Map<String, String> valuesWithTypes, + OutputStream out) { this.inputFile = inputFile; this.valuesToExport = valuesToExport; this.valueWithTypes = valuesWithTypes; @@ -61,7 +60,7 @@ public class Extractor { } } } - if(valueCollector != null) { + if (valueCollector != null) { write(pw, collector, valueCollector); } } catch (IOException e) { @@ -102,12 +101,12 @@ public class Extractor { out.printf("jobs #;%d\n", ids.size()); out.printf("job ids;%s\n", String.join(";", ids)); for (String key : valuesToExport) { - out.printf("%s;%s\n", key, String.join(";", convert(key,values4Job.get(key)))); + out.printf("%s;%s\n", key, String.join(";", convert(key, values4Job.get(key)))); } } private List<String> convert(String key, List<String> list) { - if(!valueWithTypes.containsKey(key)) { + if (!valueWithTypes.containsKey(key)) { return list; } Function<String, String> conversion = getConversion(valueWithTypes.get(key)); @@ -122,7 +121,13 @@ public class Extractor { //return str->nf.format(Double.parseDouble(str.replace("kb", ""))/1024.); return str -> "" + Double.parseDouble(str.replace("kb", ""))/1024.; case "tm": - return str-> Duration.between(LocalTime.of(0, 0, 0), LocalTime.parse(str, DateTimeFormatter.ofPattern("H:m:s"))).getSeconds() + ""; + + return str-> { + String []tokens = str.split(":"); + return Duration.ofHours(Integer.parseInt(tokens[0])) + .plusMinutes(Integer.parseInt(tokens[1])) + .plusSeconds(Integer.parseInt(tokens[2])).getSeconds() + ""; + }; } return str->str; diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ResultFileTask.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ResultFileTask.java index 7cb8b1ceca95e7588b676eec1d3b83f032e2c3eb..4f0bed3365cb2dc1fd08a856588365c88eb69df8 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ResultFileTask.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ResultFileTask.java @@ -41,7 +41,9 @@ public class ResultFileTask { .appendOptional(DateTimeFormatter.ofPattern("EEE MMM dd kk:mm:ss z yyyy")) .appendOptional(DateTimeFormatter.ofPattern("EEE MMM dd kk:mm:ss yyyy")).toFormatter(); Collection<Double> startTimeValues = retrieveValues(Constants.STATISTICS_RESOURCES_START_TIME) - .map(s -> (double) LocalDateTime.parse(s, formatter).toEpochSecond(ZoneOffset.UTC)) + .map(s -> s != null && !s.equals("null") + ? (double) LocalDateTime.parse(s, formatter).toEpochSecond(ZoneOffset.UTC) + : Double.NaN) .collect(Collectors.toList()); Collection<Double> wallTimeValues = retrieveValues(Constants.STATISTICS_RESOURCES_WALL_TIME) .map(s -> Double.parseDouble(s)).collect(Collectors.toList());