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

introduce constants, organize imports

parent b9e9efd4
No related branches found
No related tags found
No related merge requests found
package cz.it4i.fiji.haas_spim_benchmark.core;
import static cz.it4i.fiji.haas_spim_benchmark.core.Constants.BENCHMARK_RESULT_FILE;
import static cz.it4i.fiji.haas_spim_benchmark.core.Constants.HAAS_UPDATE_TIMEOUT;
import static cz.it4i.fiji.haas_spim_benchmark.core.Constants.SPIM_OUTPUT_FILENAME_PATTERN;
import static cz.it4i.fiji.haas_spim_benchmark.core.Constants.STATISTICS_TASK_NAME_MAP;
import static cz.it4i.fiji.haas_spim_benchmark.core.Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileWriter;
......@@ -75,14 +81,14 @@ public class BenchmarkJobManager {
};
};
computationAccessor = new SPIMComputationAccessorDecoratorWithTimeout(computationAccessor, Constants.HAAS_UPDATE_TIMEOUT);
computationAccessor = new SPIMComputationAccessorDecoratorWithTimeout(computationAccessor, HAAS_UPDATE_TIMEOUT/UI_TO_HAAS_FREQUENCY_UPDATE_RATIO);
}
public void startJob(Progress progress) throws IOException {
job.uploadFilesByName(Arrays.asList(Constants.CONFIG_YAML), progress);
String outputName = getOutputName(job.openLocalFile(Constants.CONFIG_YAML));
job.submit();
job.setProperty(Constants.SPIM_OUTPUT_FILENAME_PATTERN, outputName);
job.setProperty(SPIM_OUTPUT_FILENAME_PATTERN, outputName);
setDownloaded(false);
}
......@@ -92,7 +98,7 @@ public class BenchmarkJobManager {
public void downloadData(Progress progress) throws IOException {
if (job.getState() == JobState.Finished) {
String filePattern = job.getProperty(Constants.SPIM_OUTPUT_FILENAME_PATTERN);
String filePattern = job.getProperty(SPIM_OUTPUT_FILENAME_PATTERN);
job.download(downloadFinishedData(filePattern), progress);
} else if (job.getState() == JobState.Failed) {
job.download(downloadFailedData(), progress);
......@@ -103,7 +109,7 @@ public class BenchmarkJobManager {
public void downloadStatistics(Progress progress) throws IOException {
job.download(BenchmarkJobManager.downloadStatistics(), progress);
Path resultFile = job.getDirectory().resolve(Constants.BENCHMARK_RESULT_FILE);
Path resultFile = job.getDirectory().resolve(BENCHMARK_RESULT_FILE);
if (resultFile != null)
BenchmarkJobManager.formatResultFile(resultFile);
}
......@@ -192,7 +198,7 @@ public class BenchmarkJobManager {
scanner.close();
// Order tasks chronologically
List<String> chronologicList = Constants.STATISTICS_TASK_NAME_MAP.keySet().stream().collect(Collectors.toList());
List<String> chronologicList = STATISTICS_TASK_NAME_MAP.keySet().stream().collect(Collectors.toList());
Collections.sort(tasks, Comparator.comparingInt(task -> chronologicList.indexOf(task.getDescription())));
}
......
......@@ -4,7 +4,8 @@ import java.util.LinkedHashMap;
import java.util.Map;
public interface Constants {
long HAAS_UPDATE_TIMEOUT = 30000;
int HAAS_UPDATE_TIMEOUT = 30000;
short UI_TO_HAAS_FREQUENCY_UPDATE_RATIO = 10;
String HAAS_JOB_NAME = "HaaSSPIMBenchmark";
int HAAS_CLUSTER_NODE_TYPE = 6;
int HAAS_TEMPLATE_ID = 4;
......@@ -39,4 +40,5 @@ public interface Constants {
put("done", "Done");
}};
String STATISTICS_SUMMARY_FILENAME = "summary.csv";
}
......@@ -91,7 +91,7 @@ public class SPIMPipelineProgressViewController implements FXFrame.Controller {
public void run() {
fillTable();
}
}, Constants.HAAS_UPDATE_TIMEOUT / 10);
}, Constants.HAAS_UPDATE_TIMEOUT / Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO);
} else {
List<TaskComputation> computations = tasks.stream().map(task -> task.getComputations())
.collect(Collectors.<List<TaskComputation>>maxBy((a, b) -> a.size() - b.size())).get();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment