From 62d6c0304bbd6a9f060be848f2328f6a4a31a6dc Mon Sep 17 00:00:00 2001 From: Sasha Sherstnev Date: Thu, 8 Aug 2013 14:19:29 +0100 Subject: [PATCH] Improve coding style --- engine/compbio/engine/SubmissionManager.java | 12 ++++-------- engine/compbio/engine/client/ConfExecutable.java | 18 ++++++------------ .../compbio/engine/cluster/drmaa/AsyncJobRunner.java | 10 ++++------ engine/compbio/engine/local/LocalRunner.java | 18 ++++++++---------- 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/engine/compbio/engine/SubmissionManager.java b/engine/compbio/engine/SubmissionManager.java index 9d4f8d5..2880e8f 100644 --- a/engine/compbio/engine/SubmissionManager.java +++ b/engine/compbio/engine/SubmissionManager.java @@ -41,16 +41,12 @@ public class SubmissionManager { // uninitializable } - public static void addTask(ConfiguredExecutable executable, - Future> future) { - Future> replacedTask = submittedTasks.put( - executable.getTaskId(), future); + public static void addTask(ConfiguredExecutable executable, Future> future) { + Future> replacedTask = submittedTasks.put(executable.getTaskId(), future); // just a percussion should never happened if (replacedTask != null) { - log.fatal("Duplicated task id is detected by local engine for: " - + executable); - throw new RuntimeException("Duplicated task ID is detected: " - + executable.getTaskId()); + log.fatal("Duplicated task id is detected by local engine for: " + executable); + throw new RuntimeException("Duplicated task ID is detected: " + executable.getTaskId()); } } diff --git a/engine/compbio/engine/client/ConfExecutable.java b/engine/compbio/engine/client/ConfExecutable.java index 14c023f..d5fbbe7 100644 --- a/engine/compbio/engine/client/ConfExecutable.java +++ b/engine/compbio/engine/client/ConfExecutable.java @@ -224,10 +224,8 @@ public class ConfExecutable implements ConfiguredExecutable { */ public static RunnerConfig getRunnerOptions( Class> clazz) throws IOException { - String parametersFile = clazz.getSimpleName().toLowerCase() - + ".parameters.file"; - return (RunnerConfig) getRunnerConfiguration(clazz, - RunnerConfig.class, parametersFile); + String parametersFile = clazz.getSimpleName().toLowerCase() + ".parameters.file"; + return (RunnerConfig) getRunnerConfiguration(clazz, RunnerConfig.class, parametersFile); } /* @@ -236,10 +234,8 @@ public class ConfExecutable implements ConfiguredExecutable { */ public static PresetManager getRunnerPresets( Class> clazz) throws IOException { - String parametersFile = clazz.getSimpleName().toLowerCase() - + ".presets.file"; - PresetManager presets = (PresetManager) getRunnerConfiguration( - clazz, PresetManager.class, parametersFile); + String parametersFile = clazz.getSimpleName().toLowerCase() + ".presets.file"; + PresetManager presets = (PresetManager) getRunnerConfiguration(clazz, PresetManager.class, parametersFile); return presets; } @@ -254,10 +250,8 @@ public class ConfExecutable implements ConfiguredExecutable { */ public static LimitsManager getRunnerLimits(Class clazz) throws IOException { - String parametersFile = clazz.getSimpleName().toLowerCase() - + ".limits.file"; - LimitsManager limits = (LimitsManager) getRunnerConfiguration( - clazz, LimitsManager.class, parametersFile); + String parametersFile = clazz.getSimpleName().toLowerCase() + ".limits.file"; + LimitsManager limits = (LimitsManager) getRunnerConfiguration(clazz, LimitsManager.class, parametersFile); return limits; } diff --git a/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java b/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java index 940c4ad..db50916 100644 --- a/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java +++ b/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java @@ -47,8 +47,7 @@ public class AsyncJobRunner implements AsyncExecutor { public String submitJob(ConfiguredExecutable executable) throws JobSubmissionException { JobRunner jr = new JobRunner(executable); - jr.submitJob(); // ignore cluster job id as it could be retrieved from - // fs + jr.submitJob(); // ignore cluster job id as it could be retrieved from fs return executable.getTaskId(); } @@ -59,10 +58,9 @@ public class AsyncJobRunner implements AsyncExecutor { clustSession); } - /** - * This will never return clust.engine.JobStatus.CANCELLED as for sun grid - * engine cancelled job is the same as failed. Cancelled jobs needs to be - * tracked manually! + /* + * This will never return clust.engine.JobStatus.CANCELLED as for sun grid engine + * cancelled job is the same as failed. Cancelled jobs needs to be tracked manually! */ @Override public compbio.metadata.JobStatus getJobStatus(String jobId) { diff --git a/engine/compbio/engine/local/LocalRunner.java b/engine/compbio/engine/local/LocalRunner.java index b722505..208bfa0 100644 --- a/engine/compbio/engine/local/LocalRunner.java +++ b/engine/compbio/engine/local/LocalRunner.java @@ -36,8 +36,7 @@ public final class LocalRunner implements SyncExecutor { private static final Logger log = Logger.getLogger(LocalRunner.class); /* - * If is not advisable to start threads statically, thus this field is not - * static + * If is not advisable to start threads statically, thus this field is not static */ private final ExecutorService executor; private final ConfiguredExecutable executable; @@ -46,8 +45,7 @@ public final class LocalRunner implements SyncExecutor { public LocalRunner(ConfiguredExecutable executable) { if (executable == null) { - throw new IllegalArgumentException( - "Executable value is NULL. Executable must be provided!"); + throw new IllegalArgumentException("Executable value is NULL. Executable must be provided!"); } this.executor = LocalExecutorService.getExecutor(); this.executable = executable; @@ -56,8 +54,7 @@ public final class LocalRunner implements SyncExecutor { try { executable.saveRunConfiguration(); } catch (IOException e) { - log.error("Could not save run configuration! " + e.getMessage(), e - .getCause()); + log.error("Could not save run configuration! " + e.getMessage(), e.getCause()); } } @@ -84,9 +81,9 @@ public final class LocalRunner implements SyncExecutor { } @Override - public void executeJob() throws JobSubmissionException { - ExecutableWrapper ewrapper = new ExecutableWrapper(executable, - workDirectory); + public void executeJob() + throws JobSubmissionException { + ExecutableWrapper ewrapper = new ExecutableWrapper(executable, workDirectory); this.future = executor.submit(ewrapper); } @@ -94,7 +91,8 @@ public final class LocalRunner implements SyncExecutor { * @throws CancellationException */ @Override - public ConfiguredExecutable waitForResult() throws JobExecutionException { + public ConfiguredExecutable waitForResult() + throws JobExecutionException { try { return LocalEngineUtil.getResults(future, executable.getTaskId()); } catch (ResultNotAvailableException e) { -- 1.7.10.2