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

code: remove warning

parent b81619af
Branches
Tags
No related merge requests found
Showing
with 125 additions and 138 deletions
package cz.it4i.fiji.haas_java_client;
import static cz.it4i.fiji.haas_java_client.LambdaExceptionHandlerWrapper.wrap;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
......@@ -7,20 +9,17 @@ import java.nio.file.Paths;
import java.util.Collections;
import java.util.stream.StreamSupport;
import javax.xml.rpc.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cz.it4i.fiji.haas_java_client.HaaSClient.SynchronizableFiles;
import cz.it4i.fiji.haas_java_client.proxy.JobFileContentExt;
import static cz.it4i.fiji.haas_java_client.LambdaExceptionHandlerWrapper.wrap;
public class TestHaaSJavaClientWithSPIM {
private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_java_client.TestHaaSJavaClientWithSPIM.class);
public static void main(String[] args) throws ServiceException, IOException {
public static void main(String[] args) throws IOException {
HaaSClient client = new HaaSClient(SettingsProvider.getSettings("DD-17-31", TestingConstants.CONFIGURATION_FILE_NAME));
Path baseDir = Paths.get("/home/koz01/Work/vyzkumnik/fiji/work/aaa");
......
package cz.it4i.fiji.haas_spim_benchmark.commands;
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.channels.OverlappingFileLockException;
......@@ -22,7 +21,7 @@ public class FileLock implements Closeable {
private java.nio.channels.FileLock lock;
public FileLock(Path lockPath) throws FileNotFoundException {
public FileLock(Path lockPath) {
this.localPath = lockPath;
}
......
......@@ -64,30 +64,26 @@ public class ManageSPIMBenchmark implements Command {
if (!Files.isDirectory(workingDirPath)) {
Files.createDirectories(workingDirPath);
}
@SuppressWarnings("resource")
final FileLock fl = new FileLock(workingDirPath.resolve(LOCK_FILE_NAME));
if(!fl.tryLock()) {
uiService.showDialog("Working directory is already used by someone else", MessageType.ERROR_MESSAGE);
return;
}
try {
final BenchmarkSPIMWindow dialog = new BenchmarkSPIMWindow(null,
new BenchmarkSPIMParametersImpl(userName, password, Constants.PHONE, email, workingDirPath));
dialog.executeAdjustment(() -> {
dialog.setTitle(Constants.MENU_ITEM_NAME + " " + Constants.SUBMENU_ITEM_NAME);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
super.windowClosing(e);
fl.close();
}
});
dialog.setVisible(true);
final BenchmarkSPIMWindow dialog = new BenchmarkSPIMWindow(null,
new BenchmarkSPIMParametersImpl(userName, password, Constants.PHONE, email, workingDirPath));
dialog.executeAdjustment(() -> {
dialog.setTitle(Constants.MENU_ITEM_NAME + " " + Constants.SUBMENU_ITEM_NAME);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
super.windowClosing(e);
fl.close();
}
});
} catch(final IOException e) {
fl.close();
throw e;
}
dialog.setVisible(true);
});
} catch (final IOException e) {
log.error(e.getMessage(), e);
}
......
......@@ -9,7 +9,6 @@ import static cz.it4i.fiji.haas_spim_benchmark.core.Constants.UI_TO_HAAS_FREQUEN
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
......@@ -42,6 +41,8 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import net.imagej.updater.util.Progress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
......@@ -53,14 +54,13 @@ import cz.it4i.fiji.haas.HaaSOutputHolder;
import cz.it4i.fiji.haas.HaaSOutputHolderImpl;
import cz.it4i.fiji.haas.Job;
import cz.it4i.fiji.haas.JobManager;
import cz.it4i.fiji.haas_java_client.JobState;
import cz.it4i.fiji.haas_java_client.ProgressNotifier;
import cz.it4i.fiji.haas_java_client.HaaSClientSettings;
import cz.it4i.fiji.haas_java_client.JobSettings;
import cz.it4i.fiji.haas_java_client.JobSettingsBuilder;
import cz.it4i.fiji.haas_java_client.JobState;
import cz.it4i.fiji.haas_java_client.ProgressNotifier;
import cz.it4i.fiji.haas_java_client.SynchronizableFileType;
import cz.it4i.fiji.haas_java_client.UploadingFile;
import net.imagej.updater.util.Progress;
public class BenchmarkJobManager implements Closeable {
......@@ -88,8 +88,8 @@ public class BenchmarkJobManager implements Closeable {
public BenchmarkJob(Job job) {
this.job = job;
tasks = new LinkedList<Task>();
nonTaskSpecificErrors = new LinkedList<BenchmarkError>();
tasks = new LinkedList<>();
nonTaskSpecificErrors = new LinkedList<>();
computationAccessor = getComputationAccessor();
}
......@@ -358,6 +358,7 @@ public class BenchmarkJobManager implements Closeable {
// If no job count definition has been found, search through the output and list
// all errors
if (!found) {
@SuppressWarnings("resource")
Scanner scanner = new Scanner(getSnakemakeOutput());
String currentLine;
while (scanner.hasNextLine()) {
......@@ -380,6 +381,7 @@ public class BenchmarkJobManager implements Closeable {
}
// After the job count definition, task specification is expected
@SuppressWarnings("resource")
Scanner scanner = new Scanner(output.substring(processedOutputLength));
scanner.nextLine(); // Immediately after job count definition, task specification table header is
// expected
......@@ -510,7 +512,7 @@ public class BenchmarkJobManager implements Closeable {
@Override
public List<String> getFileContents(List<String> logs) {
return job.getFileContents(logs);
};
}
};
result = new SPIMComputationAccessorDecoratorWithTimeout(result,
......@@ -528,7 +530,7 @@ public class BenchmarkJobManager implements Closeable {
}
public BenchmarkJobManager(BenchmarkSPIMParameters params) throws IOException {
public BenchmarkJobManager(BenchmarkSPIMParameters params) {
jobManager = new JobManager(params.workingDirectory(), constructSettingsFromParams(params));
jobManager.setUploadFilter(this::canUpload);
}
......@@ -542,13 +544,13 @@ public class BenchmarkJobManager implements Closeable {
return convertJob(job);
}
public Collection<BenchmarkJob> getJobs() throws IOException {
public Collection<BenchmarkJob> getJobs() {
return jobManager.getJobs().stream().map(this::convertJob).collect(Collectors.toList());
}
public static void formatResultFile(Path filename) throws FileNotFoundException {
public static void formatResultFile(Path filename) {
List<ResultFileTask> identifiedTasks = new LinkedList<ResultFileTask>();
List<ResultFileTask> identifiedTasks = new LinkedList<>();
try {
String line = null;
......@@ -639,8 +641,10 @@ public class BenchmarkJobManager implements Closeable {
log.error(e.getMessage(), e);
} finally {
try {
fileWriter.flush();
fileWriter.close();
if (fileWriter != null) {
fileWriter.flush();
fileWriter.close();
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
......
......@@ -25,7 +25,7 @@ public class ResultFileTask {
public ResultFileTask(String name) {
this.name = name;
this.jobs = new LinkedList<ResultFileJob>();
this.jobs = new LinkedList<>();
}
public String getName() {
......
......@@ -25,7 +25,7 @@ public class SPIMComputationAccessorDecoratorWithTimeout implements SPIMComputat
this.intervalForQueryInMs = intervalForQueryInMs;
this.decorated = decorated;
initAllowedTypes(allowedTypes);
outputCache = new P_ResultCacheHolder<List<String>>(x -> decorated.getActualOutput(this.allowedTypes));
outputCache = new P_ResultCacheHolder<>(x -> decorated.getActualOutput(this.allowedTypes));
changedFilesCache = new P_ResultCacheHolder<>(set -> {
if (set == null) {
set = new HashSet<>();
......@@ -61,8 +61,8 @@ public class SPIMComputationAccessorDecoratorWithTimeout implements SPIMComputat
return decorated.getFileContents(logs);
}
private void initAllowedTypes(Set<SynchronizableFileType> allowedTypes) {
for (SynchronizableFileType type : allowedTypes) {
private void initAllowedTypes(Set<SynchronizableFileType> usedAllowedTypes) {
for (SynchronizableFileType type : usedAllowedTypes) {
this.allowedTypes.add(type);
this.allowedTypesIndices.put(type, this.allowedTypes.size() - 1);
}
......
......@@ -28,7 +28,7 @@ public class Task {
* Looks up next task computation (i.e. with lowest timepoint) of the current
* task and populates its parameters
*
* @param positionInOutput:
* @param positionInOutput
* Index of the output position to search from
* @return success flag
*/
......
......@@ -36,27 +36,32 @@ public class TaskComputation {
return content;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((content == null) ? 0 : content.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
Log other = (Log) obj;
if (content == null) {
if (other.content != null)
return false;
} else if (!content.equals(other.content))
return false;
if (other.content != null) { return false;}
}
else if (!content.equals(other.content)) return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (other.name != null) return false;
}
else if (!name.equals(other.name)) return false;
return true;
}
}
public static class File {
......@@ -99,7 +104,7 @@ public class TaskComputation {
this.computationAccessor = computationAccessor;
this.taskDescription = taskDescription;
this.timepoint = timepoint;
this.errors = new LinkedList<BenchmarkError>();
this.errors = new LinkedList<>();
this.state = JobState.Unknown;
updateState();
}
......@@ -147,11 +152,11 @@ public class TaskComputation {
/**
* Populates parameters of the current object by searching the output
*
* @param positionInOutput:
* @param actualPositionInOutput
* Index of the output position to search from
* @return success flag
*/
public boolean populateParameters(int positionInOutput) {
public boolean populateParameters(int actualPositionInOutput) {
// Should the state be different than unknown, there is no need to populate
// parameters
......@@ -159,7 +164,7 @@ public class TaskComputation {
return false;
}
this.positionInOutput = positionInOutput;
this.positionInOutput = actualPositionInOutput;
if (!resolveJobParameters()) {
return false;
}
......@@ -200,6 +205,7 @@ public class TaskComputation {
final String OUTPUT_PARSING_ERRONEOUS_JOB = "Error in job ";
final String desiredPatternErroneousJob = OUTPUT_PARSING_ERRONEOUS_JOB + taskDescription;
@SuppressWarnings("resource")
Scanner scanner = new Scanner(getSnakemakeOutput().substring(positionInOutput));
String currentLine;
while (scanner.hasNextLine()) {
......@@ -225,6 +231,7 @@ public class TaskComputation {
final String OUTPUT_PARSING_LOGS = "log: ";
final String OUTPUT_PARSING_JOB_ID = "jobid: ";
@SuppressWarnings("resource")
Scanner scanner = new Scanner(getSnakemakeOutput().substring(positionInOutput));
String currentLine;
while (scanner.hasNextLine()) {
......
......@@ -23,6 +23,8 @@ import java.util.function.Function;
import javax.swing.WindowConstants;
import net.imagej.updater.util.Progress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -62,7 +64,6 @@ import javafx.scene.control.Tooltip;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Region;
import mpicbg.spim.data.SpimDataException;
import net.imagej.updater.util.Progress;
public class BenchmarkSPIMControl extends BorderPane implements CloseableControl, InitiableControl {
......@@ -96,8 +97,8 @@ public class BenchmarkSPIMControl extends BorderPane implements CloseableControl
}
@Override
public void init(Window root) {
this.root = root;
public void init(Window rootWindow) {
this.root = rootWindow;
executorServiceWS = Executors.newSingleThreadExecutor();
executorServiceUI = Executors.newSingleThreadExecutor();
timer = new Timer();
......@@ -274,28 +275,22 @@ public class BenchmarkSPIMControl extends BorderPane implements CloseableControl
: new DummyProgress();
executorServiceWS.execute(() -> {
try {
List<BenchmarkJob> jobs = new LinkedList<>(manager.getJobs());
jobs.sort((bj1, bj2) -> (int) (bj1.getId() - bj2.getId()));
for (BenchmarkJob bj : jobs) {
registry.addIfAbsent(bj);
}
registry.update();
Set<ObservableValue<BenchmarkJob>> actual = new HashSet<>(this.jobs.getItems());
executorServiceFX.execute(() -> {
for (ObservableBenchmarkJob value : registry.getAllItems()) {
if (!actual.contains(value)) {
addJobToItems(value);
}
}
});
progress.done();
} catch (IOException e) {
log.error(e.getMessage(), e);
List<BenchmarkJob> inspectedJobs = new LinkedList<>(manager.getJobs());
inspectedJobs.sort((bj1, bj2) -> (int) (bj1.getId() - bj2.getId()));
for (BenchmarkJob bj : inspectedJobs) {
registry.addIfAbsent(bj);
}
registry.update();
Set<ObservableValue<BenchmarkJob>> actual = new HashSet<>(this.jobs.getItems());
executorServiceFX.execute(() -> {
for (ObservableBenchmarkJob value : registry.getAllItems()) {
if (!actual.contains(value)) {
addJobToItems(value);
}
}
});
progress.done();
});
}
......@@ -337,11 +332,11 @@ public class BenchmarkSPIMControl extends BorderPane implements CloseableControl
private void setCellValueFactoryCompletable(int index, Function<BenchmarkJob, CompletableFuture<String>> mapper) {
JavaFXRoutines.setCellValueFactory(jobs, index, mapper);
((TableColumn<ObservableBenchmarkJob, CompletableFuture<String>>) jobs.getColumns().get(index))
.setCellFactory(column -> new TableCellAdapter<ObservableBenchmarkJob, CompletableFuture<String>> //
.setCellFactory(column -> new TableCellAdapter<> //
(//
new P_TableCellUpdaterDecoratorWithToolTip<>//
(//
new FutureValueUpdater<ObservableBenchmarkJob, String, CompletableFuture<String>>//
new FutureValueUpdater<>//
(//
new StringValueUpdater<ObservableBenchmarkJob>(), executorServiceFX//
), //
......@@ -349,11 +344,7 @@ public class BenchmarkSPIMControl extends BorderPane implements CloseableControl
}
private void openJobDetailsWindow(BenchmarkJob job) {
try {
new JobDetailWindow(root, job).setVisible(true);
} catch (IOException e) {
log.error(e.getMessage(), e);
}
new JobDetailWindow(root, job).setVisible(true);
}
private void openBigDataViewer(BenchmarkJob job) {
......
package cz.it4i.fiji.haas_spim_benchmark.ui;
import java.awt.Window;
import java.io.IOException;
import cz.it4i.fiji.haas.ui.FXFrame;
import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager;
......@@ -12,13 +11,9 @@ public class BenchmarkSPIMWindow extends FXFrame<BenchmarkSPIMControl>{
private static final long serialVersionUID = 1L;
public BenchmarkSPIMWindow(Window parentWindow, BenchmarkSPIMParameters params) throws IOException {
public BenchmarkSPIMWindow(Window parentWindow, BenchmarkSPIMParameters params) {
super(parentWindow,()->{
try {
return new BenchmarkSPIMControl(new BenchmarkJobManager(params));
} catch (IOException e) {
throw new RuntimeException(e);
}
return new BenchmarkSPIMControl(new BenchmarkJobManager(params));
});
}
......
......@@ -78,11 +78,11 @@ public class HaaSOutputObservableValueRegistry implements Closeable {
String value;
private synchronized void update(String value) {
private synchronized void update(String newValue) {
String oldValue = this.value;
this.value = value;
if (value != null && oldValue == null || value == null && oldValue != null
|| value != null && !value.equals(oldValue)) {
this.value = newValue;
if (newValue != null && oldValue == null || newValue == null && oldValue != null
|| newValue != null && !newValue.equals(oldValue)) {
fireValueChangedEvent();
}
}
......
......@@ -57,13 +57,13 @@ public class JobDetailControl extends TabPane implements CloseableControl, Initi
private void enableOnlySpecificTab(Tab tabToLeaveEnabled) {
getTabs().stream().filter(node -> node != jobPropertiesTab).forEach(node -> node.setDisable(true));
getTabs().stream().filter(node -> node != tabToLeaveEnabled).forEach(node -> node.setDisable(true));
getSelectionModel().select(jobPropertiesTab);
}
private boolean isExecutionDetailsAvailable(BenchmarkJob job) {
return job.getState() == JobState.Running || job.getState() == JobState.Finished
|| job.getState() == JobState.Failed || job.getState() == JobState.Canceled;
private boolean isExecutionDetailsAvailable(BenchmarkJob inspectedJob) {
return inspectedJob.getState() == JobState.Running || inspectedJob.getState() == JobState.Finished
|| inspectedJob.getState() == JobState.Failed || inspectedJob.getState() == JobState.Canceled;
}
@Override
......
package cz.it4i.fiji.haas_spim_benchmark.ui;
import java.awt.Window;
import java.io.IOException;
import cz.it4i.fiji.haas.ui.FXFrame;
import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob;
......@@ -12,7 +11,7 @@ public class JobDetailWindow extends FXFrame<JobDetailControl>{
public JobDetailWindow(Window parentWindow, BenchmarkJob job) throws IOException {
public JobDetailWindow(Window parentWindow, BenchmarkJob job) {
super(parentWindow,()->{
return new JobDetailControl(job);
......
......@@ -57,13 +57,13 @@ public class JobPropertiesControl extends BorderPane implements Closeable {
private void fillTable() {
properties.getItems()
.add(new UpdatableObservableValue<JobPropertiesControl.P_Value>(
.add(new UpdatableObservableValue<>(
new P_Value("Input", job.getInputDirectory(), "Demo data on the Salomon IT4I cluster"),
x -> UpdateStatus.NotUpdated, x -> x));
properties.getItems().add(new UpdatableObservableValue<JobPropertiesControl.P_Value>(
properties.getItems().add(new UpdatableObservableValue<>(
new P_Value("Output", job.getOutputDirectory(), "N/A"), x -> UpdateStatus.NotUpdated, x -> x));
properties.getItems().add(new UpdatableObservableValue<JobPropertiesControl.P_Value>(
properties.getItems().add(new UpdatableObservableValue<>(
new P_Value("Working", job.getDirectory(), "N/A"), x -> UpdateStatus.NotUpdated, x -> x));
}
......
......@@ -13,7 +13,6 @@ import cz.it4i.fiji.haas.ui.CloseableControl;
import cz.it4i.fiji.haas.ui.FXFrame;
import cz.it4i.fiji.haas.ui.InitiableControl;
import cz.it4i.fiji.haas.ui.JavaFXRoutines;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.control.Alert;
......@@ -77,8 +76,8 @@ public class NewJobController extends BorderPane implements CloseableControl, In
JavaFXRoutines.initRootAndController("NewJobView.fxml", this);
getStylesheets().add(getClass().getResource("NewJobView.css").toExternalForm());
bt_create.setOnMouseClicked(X -> createPressed());
tg_inputDataLocation.selectedToggleProperty().addListener((v, old, n) -> selected(v, old, n, rb_ownInput));
tg_outputDataLocation.selectedToggleProperty().addListener((v, o, n) -> selected(v, o, n, rb_ownOutput));
tg_inputDataLocation.selectedToggleProperty().addListener((v, old, n) -> selected(n, rb_ownInput));
tg_outputDataLocation.selectedToggleProperty().addListener((v, o, n) -> selected(n, rb_ownOutput));
initSelectButton(et_inputDirectory, bt_selectInput);
initSelectButton(et_outputDirectory, bt_selectOutput);
}
......@@ -176,7 +175,7 @@ public class NewJobController extends BorderPane implements CloseableControl, In
return DataLocation.values()[DataLocation.values().length - backawardOrderOfSelected];
}
private void selected(ObservableValue<? extends Toggle> v, Toggle o, Toggle n, Parent disableIfNotSelected) {
private void selected(Toggle n, Parent disableIfNotSelected) {
disableIfNotSelected.getChildrenUnmodifiable().forEach(node -> node.setDisable(n != disableIfNotSelected));
}
......
......@@ -30,7 +30,7 @@ public class ObservableTaskRegistry extends ObservableValueRegistry<Task, Updata
@Override
protected UpdatableObservableValue<Task> constructObservableValue(Task task) {
return new UpdatableObservableValue<Task>(task, getUpdateFunction(), getStateProvider());
return new UpdatableObservableValue<>(task, getUpdateFunction(), getStateProvider());
}
private static UpdateStatus update(Task t) {
......
......@@ -119,7 +119,7 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl
tasks.setPrefWidth(PREFERRED_WIDTH);
timer = new Timer();
registry = new ObservableTaskRegistry(()-> job, task -> tasks.getItems().remove(registry.get(task)));
TableViewContextMenu<ObservableValue<Task>> menu = new TableViewContextMenu<ObservableValue<Task>>(this.tasks);
TableViewContextMenu<ObservableValue<Task>> menu = new TableViewContextMenu<>(this.tasks);
menu.addItem("Open view", (task, columnIndex) -> proof(task, columnIndex),
(x, columnIndex) -> check(x, columnIndex));
}
......@@ -160,8 +160,8 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl
}
private void fillTable() {
List<Task> tasks = job.getTasks();
if (tasks == null) {
List<Task> processedTasks = job.getTasks();
if (processedTasks == null) {
timer.schedule(new TimerTask() {
@Override
public void run() {
......@@ -170,13 +170,13 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl
}, Constants.HAAS_UPDATE_TIMEOUT / Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO);
} else {
Optional<List<TaskComputation>> optional = tasks.stream().map(task -> task.getComputations())
Optional<List<TaskComputation>> optional = processedTasks.stream().map(task -> task.getComputations())
.collect(Collectors.<List<TaskComputation>>maxBy((a, b) -> a.size() - b.size()));
if (!optional.isPresent()) {
return;
}
List<TaskComputation> computations = optional.get();
List<ObservableValue<Task>> taskList = (tasks.stream().map(task -> registry.addIfAbsent(task))
List<ObservableValue<Task>> taskList = (processedTasks.stream().map(task -> registry.addIfAbsent(task))
.collect(Collectors.toList()));
executorFx.execute(() -> {
int i = 0;
......@@ -204,9 +204,8 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl
JavaFXRoutines.setCellValueFactory(this.tasks, index, (Function<Task, TaskComputation>) v -> {
if (v.getComputations().size() >= index) {
return v.getComputations().get(index - 1);
} else {
return null;
}
}
return null;
});
((TableColumn<ObservableValue<Task>, TaskComputation>) this.tasks.getColumns().get(index))
.setCellFactory(column -> new TableCellAdapter<>((cell, val, empty) -> {
......
......@@ -38,7 +38,7 @@ public class TaskComputationAdapter implements Closeable {
public void init() {
Map<String, Long> sizes = computation.getOutFileSizes();
computation.getOutputs().forEach(outputFile -> addOutputFile(outputFile, sizes.get(outputFile)));
computation.getLogs().forEach(log -> logs.add(new ObservableLog(log)));
computation.getLogs().forEach(decoratedLog -> logs.add(new ObservableLog(decoratedLog)));
synchronized (this) {
if(timer != null) {
timer.schedule(new P_TimerTask(), Constants.HAAS_TIMEOUT, Constants.HAAS_TIMEOUT);
......@@ -94,21 +94,21 @@ public class TaskComputationAdapter implements Closeable {
private class P_ObservableString extends ObservableValueBase<String> {
private String value;
private String innerValue;
public P_ObservableString(String value) {
this.value = value;
this.innerValue = value;
}
@Override
public String getValue() {
return value;
return innerValue;
}
public void setValue(String value) {
if(this.value != null && !this.value.equals(value) ||
value != null && !value.equals(this.value)) {
this.value = value;
if(this.innerValue != null && !this.innerValue.equals(value) ||
value != null && !value.equals(this.innerValue)) {
this.innerValue = value;
fireValueChangedEvent();
}
}
......@@ -159,10 +159,10 @@ public class TaskComputationAdapter implements Closeable {
@Override
public void run() {
Map<String, Long> sizes = computation.getOutFileSizes();
Map<String, Log> logs = computation.getLogs().stream()
.collect(Collectors.<Log, String, Log>toMap((Log log) -> log.getName(), (Log log) -> log));
Map<String, Log> computationLogs = computation.getLogs().stream()
.collect(Collectors.<Log, String, Log>toMap((Log l) -> l.getName(), (Log l) -> l));
TaskComputationAdapter.this.logs
.forEach(log -> log.setContentValue(logs.get(log.getName())));
.forEach(processedLog -> processedLog.setContentValue(computationLogs.get(processedLog.getName())));
outputs.forEach(value -> ((ObservableOutputFile) value).setSize(sizes.get(value.getValue().getName())));
}
......
......@@ -59,10 +59,10 @@ public class TaskComputationControl extends TabPane implements CloseableControl,
remoteFilesInfo.setFiles(adapter.getOutputs());
remoteFilesInfo.init(parameter);
Collection<Runnable> runs = new LinkedList<>();
for (ObservableLog log : adapter.getLogs()) {
for (ObservableLog observableLog : adapter.getLogs()) {
LogViewControl logViewControl = new LogViewControl();
logViewControl.setObservable(log.getContent());
runs.add(() -> addTab(log.getName(), logViewControl));
logViewControl.setObservable(observableLog.getContent());
runs.add(() -> addTab(observableLog.getName(), logViewControl));
}
uiExecutor.execute(() -> runs.forEach(r -> r.run()));
});
......
package cz.it4i.fiji.haas;
import java.io.FileNotFoundException;
import java.nio.file.Paths;
import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager;
public class FormatResultFileRun {
public static void main(String[] args) throws FileNotFoundException {
public static void main(String[] args) {
BenchmarkJobManager.formatResultFile(Paths.get(args[0]));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment