From: Sasha Sherstnev Date: Fri, 20 Sep 2013 14:32:07 +0000 (+0100) Subject: Refactoring: rename duplicated Util classes X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b2a2fdc2bd95a64b3908d8ea2f31270b6c7199d3;p=jabaws.git Refactoring: rename duplicated Util classes --- diff --git a/engine/compbio/engine/ClusterJobId.java b/engine/compbio/engine/ClusterJobId.java index 9a1f1d1..d578c37 100644 --- a/engine/compbio/engine/ClusterJobId.java +++ b/engine/compbio/engine/ClusterJobId.java @@ -20,6 +20,7 @@ package compbio.engine; import compbio.util.Util; import compbio.util.annotation.Immutable; +import compbio.engine.client.EngineUtil; @Immutable public class ClusterJobId { @@ -30,10 +31,8 @@ public class ClusterJobId { if (Util.isEmpty(jobId)) { throw new NullPointerException("JobId must be provided!"); } - if (compbio.engine.client.Util.isValidJobId(jobId)) { - throw new IllegalArgumentException( - "JobId is expected but taskid seems to be provided! " - + jobId); + if (EngineUtil.isValidJobId(jobId)) { + throw new IllegalArgumentException("JobId is expected but taskid seems to be provided! " + jobId); } this.jobId = jobId; } diff --git a/engine/compbio/engine/Configurator.java b/engine/compbio/engine/Configurator.java index 96c232d..1aa18ea 100644 --- a/engine/compbio/engine/Configurator.java +++ b/engine/compbio/engine/Configurator.java @@ -29,6 +29,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.PathValidator; +import compbio.engine.client.EngineUtil; import compbio.engine.cluster.drmaa.AsyncJobRunner; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.conf.DirectoryManager; @@ -90,7 +91,7 @@ public class Configurator { } if (!PathValidator.isAbsolutePath(tmp_dir)) { log.debug("local.tmp.directory path is relative! " + tmp_dir); - tmp_dir = compbio.engine.client.Util.convertToAbsolute(tmp_dir); + tmp_dir = EngineUtil.convertToAbsolute(tmp_dir); log.debug("local.tmp.directory path changed to absolute: " + tmp_dir); } return tmp_dir.trim(); @@ -303,7 +304,7 @@ public class Configurator { if (Util.isEmpty(taskId)) { throw new NullPointerException("TaskId must be provided!"); } - if (!compbio.engine.client.Util.isValidJobId(taskId)) { + if (!EngineUtil.isValidJobId(taskId)) { throw new InvalidParameterException("TaskId is not valid!"); } return !taskId.startsWith(ConfExecutable.CLUSTER_TASK_ID_PREFIX); @@ -311,7 +312,7 @@ public class Configurator { public static String getWorkDirectory(String taskId) { assert !compbio.util.Util.isEmpty(taskId); - assert compbio.engine.client.Util.isValidJobId(taskId); + assert EngineUtil.isValidJobId(taskId); log.info("Getting workdirectory for TaskID: " + taskId); if (taskId.startsWith(ConfExecutable.CLUSTER_TASK_ID_PREFIX)) { return CLUSTER_WORK_DIRECTORY + File.separator + taskId; diff --git a/engine/compbio/engine/Job.java b/engine/compbio/engine/Job.java index 6d5f10f..13a3df4 100644 --- a/engine/compbio/engine/Job.java +++ b/engine/compbio/engine/Job.java @@ -21,7 +21,7 @@ package compbio.engine; import java.util.List; import compbio.engine.client.ConfiguredExecutable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.util.annotation.Immutable; @Immutable @@ -32,7 +32,7 @@ public final class Job { private final ConfiguredExecutable cexecutable; public Job(String taskId, String jobId, ConfiguredExecutable cexecutable) { - if (!Util.isValidJobId(taskId)) { + if (!EngineUtil.isValidJobId(taskId)) { throw new IllegalArgumentException("TaskId " + taskId + " is not valid!"); } diff --git a/engine/compbio/engine/SubmissionManager.java b/engine/compbio/engine/SubmissionManager.java index 2880e8f..482c70a 100644 --- a/engine/compbio/engine/SubmissionManager.java +++ b/engine/compbio/engine/SubmissionManager.java @@ -25,6 +25,7 @@ import java.util.concurrent.Future; import org.apache.log4j.Logger; import compbio.engine.client.ConfiguredExecutable; +import compbio.engine.client.EngineUtil; /** * Submit jobs for execution @@ -58,14 +59,14 @@ public class SubmissionManager { synchronized (submittedTasks) { assert executable != null; String taskId = executable.getTaskId(); - assert compbio.engine.client.Util.isValidJobId(taskId); + assert EngineUtil.isValidJobId(taskId); submittedTasks.remove(taskId); } } public static void removeTask(String key) { synchronized (submittedTasks) { - if (compbio.engine.client.Util.isValidJobId(key)) { + if (EngineUtil.isValidJobId(key)) { submittedTasks.remove(key); } else { log.error("Invalid key is given! " + key); diff --git a/engine/compbio/engine/client/ConfExecutable.java b/engine/compbio/engine/client/ConfExecutable.java index d8260c8..e64d212 100644 --- a/engine/compbio/engine/client/ConfExecutable.java +++ b/engine/compbio/engine/client/ConfExecutable.java @@ -96,8 +96,7 @@ public class ConfExecutable implements ConfiguredExecutable { @Override public String getCommand(ExecProvider provider) throws UnsupportedRuntimeException { - String command = compbio.engine.client.Util.getCommand(provider, - exec.getClass()); + String command = EngineUtil.getCommand(provider, exec.getClass()); if (Util.isEmpty(command)) { throw new UnsupportedRuntimeException( "Executable " @@ -112,7 +111,7 @@ public class ConfExecutable implements ConfiguredExecutable { @Override public ExecProvider getSupportedRuntimes() { - return compbio.engine.client.Util.getSupportedRuntimes(exec.getClass()); + return EngineUtil.getSupportedRuntimes(exec.getClass()); } @Override @@ -165,8 +164,7 @@ public class ConfExecutable implements ConfiguredExecutable { List getFullPath(List fileNames) { List files = new ArrayList(); for (String fileName : fileNames) { - files.add(compbio.engine.client.Util.getFullPath(workDirectory, - fileName)); + files.add(EngineUtil.getFullPath(workDirectory, fileName)); } return files; } @@ -182,7 +180,7 @@ public class ConfExecutable implements ConfiguredExecutable { if (PathValidator.isAbsolutePath(path)) { return path; } - return compbio.engine.client.Util.getFullPath(workDirectory, path); + return EngineUtil.getFullPath(workDirectory, path); } @Override diff --git a/engine/compbio/engine/client/Util.java b/engine/compbio/engine/client/EngineUtil.java similarity index 94% rename from engine/compbio/engine/client/Util.java rename to engine/compbio/engine/client/EngineUtil.java index 5eda4b6..e5eb946 100644 --- a/engine/compbio/engine/client/Util.java +++ b/engine/compbio/engine/client/EngineUtil.java @@ -38,12 +38,12 @@ import compbio.util.FileUtil; import compbio.util.PropertyHelper; import compbio.util.SysPrefs; -public final class Util { +public final class EngineUtil { private static final PropertyHelper ph = PropertyHelperManager .getPropertyHelper(); - private static final Logger log = Logger.getLogger(Util.class); + private static final Logger log = Logger.getLogger(EngineUtil.class); public static boolean isValidJobId(final String key) { if (compbio.util.Util.isEmpty(key)) { @@ -184,7 +184,7 @@ public final class Util { String absolute = relativePath; if (!PathValidator.isAbsolutePath(relativePath)) { absolute = PropertyHelperManager.getLocalPath() + relativePath; - Util.log.trace("Changing local path in enviromental variable to absolute: FROM " + EngineUtil.log.trace("Changing local path in enviromental variable to absolute: FROM " + relativePath + " TO " + absolute); } return absolute; @@ -193,7 +193,7 @@ public final class Util { public static String getExecProperty(String propertySpec, Executable exec) { assert !compbio.util.Util.isEmpty(propertySpec); assert exec != null; - return Util.getExecProperty(propertySpec, exec.getClass()); + return EngineUtil.getExecProperty(propertySpec, exec.getClass()); } public static String getExecProperty(String propertySpec, Class clazz) { @@ -403,11 +403,11 @@ public final class Util { try { limits = ConfExecutable.getRunnerLimits(clazz); } catch (FileNotFoundException e) { - Util.log.warn("No limits are found for " + clazz + " executable! " + EngineUtil.log.warn("No limits are found for " + clazz + " executable! " + e.getLocalizedMessage(), e.getCause()); // its ok, limit may not be initialized } catch (IOException e) { - Util.log.warn("IO exception while attempting to read limits for " + EngineUtil.log.warn("IO exception while attempting to read limits for " + clazz + " executable! " + e.getLocalizedMessage(), e.getCause()); } diff --git a/engine/compbio/engine/client/EnvVariableProcessor.java b/engine/compbio/engine/client/EnvVariableProcessor.java index 5d161df..c78886e 100644 --- a/engine/compbio/engine/client/EnvVariableProcessor.java +++ b/engine/compbio/engine/client/EnvVariableProcessor.java @@ -18,7 +18,6 @@ package compbio.engine.client; -import java.util.Arrays; import java.util.Collections; import java.util.Map; @@ -79,8 +78,6 @@ public class EnvVariableProcessor { return property.contains(PROP_NAME_VALUE_SEPARATOR); } - - /* * This is a horrible hack, but it only requires to simplify configuration * for users, could be removed at any time if proved to be a burden to @@ -113,8 +110,7 @@ public class EnvVariableProcessor { if (varName.equalsIgnoreCase(mafft_binaries) || varName.equalsIgnoreCase(fasta4mafft) || varName.equalsIgnoreCase(iupred_path)) { - varValue = compbio.engine.client.Util - .convertToAbsolute(varValue); + varValue = EngineUtil.convertToAbsolute(varValue); } } vars.put(varName, varValue); diff --git a/engine/compbio/engine/client/SkeletalExecutable.java b/engine/compbio/engine/client/SkeletalExecutable.java index b991440..dbdff47 100644 --- a/engine/compbio/engine/client/SkeletalExecutable.java +++ b/engine/compbio/engine/client/SkeletalExecutable.java @@ -133,8 +133,7 @@ public abstract class SkeletalExecutable implements Executable { if (command.value == null) { continue; } - String propertyPath = compbio.engine.client.Util.getExecProperty( - command.name + ".path", getType()); + String propertyPath = EngineUtil.getExecProperty(command.name + ".path", getType()); if (Util.isEmpty(propertyPath)) { continue; } @@ -145,7 +144,7 @@ public abstract class SkeletalExecutable implements Executable { // necessary continue; } - String absMatrixPath = compbio.engine.client.Util.convertToAbsolute(propertyPath); + String absMatrixPath = EngineUtil.convertToAbsolute(propertyPath); command.value = absMatrixPath + File.separator + command.value; cbuilder.setParam(command); } @@ -313,7 +312,7 @@ public abstract class SkeletalExecutable implements Executable { public LimitsManager getLimits() { synchronized (SkeletalExecutable.class) { if (limits == null) { - limits = compbio.engine.client.Util.getLimits(this.getType()); + limits = EngineUtil.getLimits(this.getType()); } } return limits; diff --git a/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java b/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java index db50916..1cd3197 100644 --- a/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java +++ b/engine/compbio/engine/cluster/drmaa/AsyncJobRunner.java @@ -25,7 +25,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Cleaner; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.metadata.JobSubmissionException; import compbio.metadata.ResultNotAvailableException; @@ -54,7 +54,7 @@ public class AsyncJobRunner implements AsyncExecutor { @Override public boolean cancelJob(String jobId) { ClusterSession clustSession = ClusterSession.getInstance(); - return compbio.engine.cluster.drmaa.ClusterUtil.cancelJob(jobId, + return compbio.engine.cluster.drmaa.ClusterEngineUtil.cancelJob(jobId, clustSession); } @@ -77,7 +77,7 @@ public class AsyncJobRunner implements AsyncExecutor { public ConfiguredExecutable getResults(String jobId) throws ResultNotAvailableException { - assert Util.isValidJobId(jobId); + assert EngineUtil.isValidJobId(jobId); ClusterSession csession = ClusterSession.getInstance(); ConfiguredExecutable exec; diff --git a/engine/compbio/engine/cluster/drmaa/ClusterUtil.java b/engine/compbio/engine/cluster/drmaa/ClusterEngineUtil.java similarity index 76% rename from engine/compbio/engine/cluster/drmaa/ClusterUtil.java rename to engine/compbio/engine/cluster/drmaa/ClusterEngineUtil.java index 803b169..e9ca1d7 100644 --- a/engine/compbio/engine/cluster/drmaa/ClusterUtil.java +++ b/engine/compbio/engine/cluster/drmaa/ClusterEngineUtil.java @@ -26,16 +26,15 @@ import org.ggf.drmaa.JobInfo; import org.ggf.drmaa.Session; import compbio.engine.Configurator; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.metadata.JobExecutionException; import compbio.metadata.JobStatus; -public class ClusterUtil { +public class ClusterEngineUtil { - private static final Logger log = Logger.getLogger(ClusterUtil.class); + private static final Logger log = Logger.getLogger(ClusterEngineUtil.class); - public static final NumberFormat CLUSTER_STAT_IN_SEC = NumberFormat - .getInstance(); + public static final NumberFormat CLUSTER_STAT_IN_SEC = NumberFormat.getInstance(); static { CLUSTER_STAT_IN_SEC.setMinimumFractionDigits(4); @@ -43,30 +42,23 @@ public class ClusterUtil { public static final boolean cancelJob(final String jobId, ClusterSession csession) { - assert Util.isValidJobId(jobId); + assert EngineUtil.isValidJobId(jobId); boolean cancelled = true; Session session = csession.getSession(); try { log.info("Job " + jobId + " is successfully cancelled"); - compbio.engine.client.Util.writeMarker(Configurator.getWorkDirectory(jobId), - JobStatus.CANCELLED); - session.control(ClusterSession.getClusterJobId(jobId).getJobId(), - Session.TERMINATE); + EngineUtil.writeMarker(Configurator.getWorkDirectory(jobId), JobStatus.CANCELLED); + session.control(ClusterSession.getClusterJobId(jobId).getJobId(), Session.TERMINATE); } catch (DrmaaException e) { // Log silently log.error("Job " + jobId + " cancellation failed!"); log.error("Cause: " + e.getLocalizedMessage(), e.getCause()); cancelled = false; } catch (IOException e) { - log.error( - "Could not read JOBID file to determine cluster jobid for taskid: " - + jobId + " Message: " + e.getLocalizedMessage(), e - .getCause()); + log.error("Could not read JOBID file to determine cluster jobid for taskid: " + + jobId + " Message: " + e.getLocalizedMessage(), e.getCause()); } finally { - log - .trace("Job " - + jobId - + " has been successfully removed from the cluster engine job list"); + log.trace("Job " + jobId + " has been successfully removed from the cluster engine job list"); csession.removeJob(jobId); } return cancelled; @@ -75,7 +67,7 @@ public class ClusterUtil { public static final JobInfo waitForResult(ClusterSession csession, String jobId) throws JobExecutionException { JobInfo jinfo = null; - assert Util.isValidJobId(jobId); + assert EngineUtil.isValidJobId(jobId); try { jinfo = csession.waitForJob(jobId); } catch (DrmaaException e) { diff --git a/engine/compbio/engine/cluster/drmaa/ClusterSession.java b/engine/compbio/engine/cluster/drmaa/ClusterSession.java index ca2f531..431c39f 100644 --- a/engine/compbio/engine/cluster/drmaa/ClusterSession.java +++ b/engine/compbio/engine/cluster/drmaa/ClusterSession.java @@ -33,8 +33,10 @@ import org.ggf.drmaa.SessionFactory; import compbio.engine.ClusterJobId; import compbio.engine.Job; +import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.PathValidator; +import compbio.engine.client.EngineUtil; import compbio.engine.conf.PropertyHelperManager; import compbio.metadata.JobStatus; import compbio.metadata.ResultNotAvailableException; @@ -136,18 +138,16 @@ public final class ClusterSession { + taskDirectory; assert !Util.isEmpty(jobId); - compbio.engine.client.Util.writeStatFile(executable.getWorkDirectory(), - JobStatus.SUBMITTED.toString()); - compbio.engine.client.Util.writeFile(executable.getWorkDirectory(), - JOBID, jobId, false); + EngineUtil.writeStatFile(executable.getWorkDirectory(), JobStatus.SUBMITTED.toString()); + EngineUtil.writeFile(executable.getWorkDirectory(), JOBID, jobId, false); log.debug("Adding taskId: " + taskDirectory + " to cluster job list"); - assert compbio.engine.client.Util.isValidJobId(taskDirectory); + assert EngineUtil.isValidJobId(taskDirectory); jobs.add(new Job(taskDirectory, jobId, executable)); } public void removeJob(String taskId) { assert !Util.isEmpty(taskId); - assert compbio.engine.client.Util.isValidJobId(taskId); + assert EngineUtil.isValidJobId(taskId); removeJobFromListbyTaskId(taskId); } @@ -207,9 +207,7 @@ public final class ClusterSession { // Once the job has been waited for it will be finished // Next time it will not be found in the session, so removed from the // job list - compbio.engine.client.Util.writeStatFile( - compbio.engine.Configurator.getWorkDirectory(jobId), - JobStatus.FINISHED.toString()); + EngineUtil.writeStatFile(Configurator.getWorkDirectory(jobId), JobStatus.FINISHED.toString()); return status; } @@ -226,7 +224,7 @@ public final class ClusterSession { public ConfiguredExecutable getResults(String taskId) throws DrmaaException, ResultNotAvailableException { - compbio.engine.client.Util.isValidJobId(taskId); + EngineUtil.isValidJobId(taskId); try { JobInfo status = waitForJob(taskId); } catch (InvalidJobException e) { @@ -249,10 +247,10 @@ public final class ClusterSession { // If task was not find in the list of jobs, than it must have been // collected already // Resurrect the job to find out there the output is - exec = compbio.engine.client.Util.loadExecutable(taskId); + exec = EngineUtil.loadExecutable(taskId); } if (exec != null) { - compbio.engine.client.Util.writeMarker(exec.getWorkDirectory(), + EngineUtil.writeMarker(exec.getWorkDirectory(), JobStatus.COLLECTED); } return exec; diff --git a/engine/compbio/engine/cluster/drmaa/JobRunner.java b/engine/compbio/engine/cluster/drmaa/JobRunner.java index a3f002a..516c3eb 100644 --- a/engine/compbio/engine/cluster/drmaa/JobRunner.java +++ b/engine/compbio/engine/cluster/drmaa/JobRunner.java @@ -39,7 +39,7 @@ import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.PathValidator; import compbio.engine.client.PipedExecutable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.engine.client.Executable.ExecProvider; import compbio.metadata.JobExecutionException; import compbio.metadata.JobStatus; @@ -195,7 +195,7 @@ public class JobRunner implements SyncExecutor { log.trace("Setting job environment to:" + env_variables); Map sysEnv = jobtempl.getJobEnvironment(); if (sysEnv != null && !sysEnv.isEmpty()) { - Util.mergeEnvVariables(sysEnv, env_variables); + EngineUtil.mergeEnvVariables(sysEnv, env_variables); } else { sysEnv = env_variables; } @@ -231,14 +231,11 @@ public class JobRunner implements SyncExecutor { ClusterJobId clusterJobId = ClusterSession.getClusterJobId(jobId); switch (clustSession.getJobStatus(clusterJobId)) { case Session.DONE: - compbio.engine.client.Util.writeStatFile(Configurator.getWorkDirectory(jobId), - JobStatus.FINISHED.toString()); - + EngineUtil.writeStatFile(Configurator.getWorkDirectory(jobId), JobStatus.FINISHED.toString()); return compbio.metadata.JobStatus.FINISHED; - case Session.FAILED: - compbio.engine.client.Util.writeMarker(Configurator.getWorkDirectory(jobId), - JobStatus.FAILED); + case Session.FAILED: + EngineUtil.writeMarker(Configurator.getWorkDirectory(jobId), JobStatus.FAILED); return compbio.metadata.JobStatus.FAILED; case Session.RUNNING: @@ -285,14 +282,14 @@ public class JobRunner implements SyncExecutor { * cancelled, finished or failed. */ String workDir = Configurator.getWorkDirectory(jobId); - if (Util.isMarked(workDir, JobStatus.FINISHED) - || Util.isMarked(workDir, JobStatus.COLLECTED)) { + if (EngineUtil.isMarked(workDir, JobStatus.FINISHED) + || EngineUtil.isMarked(workDir, JobStatus.COLLECTED)) { return JobStatus.FINISHED; } - if (Util.isMarked(workDir, JobStatus.CANCELLED)) { + if (EngineUtil.isMarked(workDir, JobStatus.CANCELLED)) { return JobStatus.CANCELLED; } - if (Util.isMarked(workDir, JobStatus.FAILED)) { + if (EngineUtil.isMarked(workDir, JobStatus.FAILED)) { return JobStatus.FAILED; } return JobStatus.UNDEFINED; @@ -315,13 +312,13 @@ public class JobRunner implements SyncExecutor { } JobInfo waitForJob(String jobId) throws JobExecutionException { - assert Util.isValidJobId(jobId); - return ClusterUtil.waitForResult(clustSession, jobId); + assert EngineUtil.isValidJobId(jobId); + return ClusterEngineUtil.waitForResult(clustSession, jobId); } boolean cancelJob(String jobId) { - assert Util.isValidJobId(jobId); - return compbio.engine.cluster.drmaa.ClusterUtil.cancelJob(jobId, + assert EngineUtil.isValidJobId(jobId); + return compbio.engine.cluster.drmaa.ClusterEngineUtil.cancelJob(jobId, clustSession); } diff --git a/engine/compbio/engine/conf/DirectoryManager.java b/engine/compbio/engine/conf/DirectoryManager.java index adceacc..6b59d20 100644 --- a/engine/compbio/engine/conf/DirectoryManager.java +++ b/engine/compbio/engine/conf/DirectoryManager.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import compbio.engine.client.ConfExecutable; import compbio.engine.client.Executable; +import compbio.engine.client.EngineUtil; import compbio.util.Util; public class DirectoryManager { @@ -45,7 +46,7 @@ public class DirectoryManager { } public static Class> getClass(String taskId) { - assert compbio.engine.client.Util.isValidJobId(taskId); + assert EngineUtil.isValidJobId(taskId); String className = null; if (taskId.startsWith(ConfExecutable.CLUSTER_TASK_ID_PREFIX)) { className = taskId.substring(1, taskId.indexOf(DELIM)); @@ -55,9 +56,7 @@ public class DirectoryManager { try { return (Class>) Class.forName(className); } catch (ClassNotFoundException e) { - log.error( - "Could not parse taskId " + taskId + " Message " - + e.getLocalizedMessage(), e.getCause()); + log.error("Could not parse taskId " + taskId + " Message " + e.getLocalizedMessage(), e.getCause()); } return null; } diff --git a/engine/compbio/engine/local/AsyncLocalRunner.java b/engine/compbio/engine/local/AsyncLocalRunner.java index d269aad..084cc34 100644 --- a/engine/compbio/engine/local/AsyncLocalRunner.java +++ b/engine/compbio/engine/local/AsyncLocalRunner.java @@ -27,7 +27,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.SubmissionManager; import compbio.engine.client.ConfiguredExecutable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; import compbio.metadata.ResultNotAvailableException; @@ -43,8 +43,7 @@ public final class AsyncLocalRunner implements AsyncExecutor { @Override public boolean cancelJob(String jobId) { - Future> future = SubmissionManager - .getTask(jobId); + Future> future = SubmissionManager.getTask(jobId); // The job has already finished or cancelled. if (future == null) { log.debug("Did not find future for local job " @@ -58,8 +57,7 @@ public final class AsyncLocalRunner implements AsyncExecutor { @Override public JobStatus getJobStatus(String jobId) { - Future> future = SubmissionManager - .getTask(jobId); + Future> future = SubmissionManager.getTask(jobId); if (future == null) { return LocalEngineUtil.getRecordedJobStatus(jobId); } @@ -77,8 +75,7 @@ public final class AsyncLocalRunner implements AsyncExecutor { Future> future = lrunner.getFuture(); if (future == null) { - throw new RuntimeException("Future is NULL for executable " - + executable); + throw new RuntimeException("Future is NULL for executable " + executable); } SubmissionManager.addTask(executable, future); return executable.getTaskId(); @@ -97,11 +94,9 @@ public final class AsyncLocalRunner implements AsyncExecutor { try { cexec = future.get(); } catch (InterruptedException e) { - log.error("Cannot clean up as calculation was not completed!" - + e.getLocalizedMessage()); + log.error("Cannot clean up as calculation was not completed!" + e.getLocalizedMessage()); } catch (ExecutionException e) { - log.error("Cannot clean up due to ExecutionException " - + e.getLocalizedMessage()); + log.error("Cannot clean up due to ExecutionException " + e.getLocalizedMessage()); } if (cexec == null) { return false; @@ -112,7 +107,7 @@ public final class AsyncLocalRunner implements AsyncExecutor { @Override public ConfiguredExecutable getResults(String taskId) throws ResultNotAvailableException { - if (!Util.isValidJobId(taskId)) { + if (!EngineUtil.isValidJobId(taskId)) { // TODO should I be throwing something else? throw new IllegalArgumentException(taskId); } @@ -122,8 +117,7 @@ public final class AsyncLocalRunner implements AsyncExecutor { // If task was not find in the list of jobs, than it must have been // collected already // Resurrect the job to find out there the output is - ConfiguredExecutable exec = compbio.engine.client.Util - .loadExecutable(taskId); + ConfiguredExecutable exec = EngineUtil.loadExecutable(taskId); return exec; } return LocalEngineUtil.getResults(futureExec, taskId); diff --git a/engine/compbio/engine/local/ExecutableWrapper.java b/engine/compbio/engine/local/ExecutableWrapper.java index 8718013..b9bf00a 100644 --- a/engine/compbio/engine/local/ExecutableWrapper.java +++ b/engine/compbio/engine/local/ExecutableWrapper.java @@ -38,7 +38,7 @@ import org.apache.log4j.Logger; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.PathValidator; import compbio.engine.client.PipedExecutable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.engine.client.Executable.ExecProvider; import compbio.engine.local.StreamGobbler.OutputType; import compbio.metadata.JobStatus; @@ -77,7 +77,7 @@ public final class ExecutableWrapper implements pbuilder = new ProcessBuilder(params); if (executable.getEnvironment() != null) { log.debug("Setting command environment variables: " + pbuilder.environment()); - Util.mergeEnvVariables(pbuilder.environment(), executable.getEnvironment()); + EngineUtil.mergeEnvVariables(pbuilder.environment(), executable.getEnvironment()); log.debug("Process environment:" + pbuilder.environment()); } log.debug("Setting command: " + pbuilder.command()); @@ -138,7 +138,7 @@ public final class ExecutableWrapper implements try { log.info("Calculation started at " + System.nanoTime()); - Util.writeStatFile(confExec.getWorkDirectory(), JobStatus.STARTED.toString()); + EngineUtil.writeStatFile(confExec.getWorkDirectory(), JobStatus.STARTED.toString()); proc = pbuilder.start(); // store input command and program environment @@ -168,7 +168,7 @@ public final class ExecutableWrapper implements // any error??? int exitVal = proc.waitFor(); log.info("Calculation completed at " + System.nanoTime()); - Util.writeStatFile(confExec.getWorkDirectory(), JobStatus.FINISHED.toString()); + EngineUtil.writeStatFile(confExec.getWorkDirectory(), JobStatus.FINISHED.toString()); // Let streams to write for a little more errorf.get(2, TimeUnit.SECONDS); outputf.get(2, TimeUnit.SECONDS); diff --git a/engine/compbio/engine/local/LocalEngineUtil.java b/engine/compbio/engine/local/LocalEngineUtil.java index 6ecdc32..c00c6df 100644 --- a/engine/compbio/engine/local/LocalEngineUtil.java +++ b/engine/compbio/engine/local/LocalEngineUtil.java @@ -27,7 +27,7 @@ import compbio.engine.Cleaner; import compbio.engine.Configurator; import compbio.engine.SubmissionManager; import compbio.engine.client.ConfiguredExecutable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.metadata.JobStatus; import compbio.metadata.ResultNotAvailableException; @@ -56,8 +56,7 @@ public final class LocalEngineUtil { public static boolean cancelJob(Future> future, String workDirectory) { - compbio.engine.client.Util.writeMarker(workDirectory, - JobStatus.CANCELLED); + EngineUtil.writeMarker(workDirectory, JobStatus.CANCELLED); log.debug("Cancelling local job from work directory " + workDirectory); return future.cancel(true); } @@ -80,14 +79,14 @@ public final class LocalEngineUtil { // job has been removed from the task list // but there may be status written to the disk String workDir = Configurator.getWorkDirectory(jobId); - if (Util.isMarked(workDir, JobStatus.FINISHED) - || Util.isMarked(workDir, JobStatus.COLLECTED)) { + if (EngineUtil.isMarked(workDir, JobStatus.FINISHED) + || EngineUtil.isMarked(workDir, JobStatus.COLLECTED)) { return JobStatus.FINISHED; } - if (Util.isMarked(workDir, JobStatus.CANCELLED)) { + if (EngineUtil.isMarked(workDir, JobStatus.CANCELLED)) { return JobStatus.CANCELLED; } - if (Util.isMarked(workDir, JobStatus.FAILED)) { + if (EngineUtil.isMarked(workDir, JobStatus.FAILED)) { return JobStatus.FAILED; } return JobStatus.UNDEFINED; @@ -112,13 +111,11 @@ public final class LocalEngineUtil { + Configurator.getWorkDirectory(taskId) + " Job id is " + taskId); } - compbio.engine.client.Util.writeMarker(Configurator - .getWorkDirectory(taskId), JobStatus.COLLECTED); + EngineUtil.writeMarker(Configurator.getWorkDirectory(taskId), JobStatus.COLLECTED); } catch (InterruptedException e) { // reassert threads interrupted status Thread.currentThread().interrupt(); - compbio.engine.client.Util.writeMarker(Configurator - .getWorkDirectory(taskId), JobStatus.FAILED); + EngineUtil.writeMarker(Configurator.getWorkDirectory(taskId), JobStatus.FAILED); // Cancel the job log.debug("Cancelling job due to Interruption"); future.cancel(true); @@ -126,10 +123,8 @@ public final class LocalEngineUtil { // this.cleanup(taskId); } catch (ExecutionException e) { // this.cleanup(taskId); - compbio.engine.client.Util.writeMarker(Configurator - .getWorkDirectory(taskId), JobStatus.FAILED); - log.debug("Job execution exception: " + e.getLocalizedMessage(), e - .getCause()); + EngineUtil.writeMarker(Configurator .getWorkDirectory(taskId), JobStatus.FAILED); + log.debug("Job execution exception: " + e.getLocalizedMessage(), e.getCause()); // ExecutionException returned as thus Throwable needs unwrapping LocalEngineUtil.launderThrowable(e.getCause()); } finally { diff --git a/runner/compbio/runner/Util.java b/runner/compbio/runner/RunnerUtil.java similarity index 90% rename from runner/compbio/runner/Util.java rename to runner/compbio/runner/RunnerUtil.java index f8d7b80..5d02a18 100644 --- a/runner/compbio/runner/Util.java +++ b/runner/compbio/runner/RunnerUtil.java @@ -39,13 +39,14 @@ import compbio.data.sequence.UnknownFileFormatException; import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; +import compbio.engine.client.EngineUtil; import compbio.metadata.JobSubmissionException; import compbio.metadata.PresetManager; import compbio.metadata.RunnerConfig; -public final class Util { +public final class RunnerUtil { - public static Logger log = Logger.getLogger(Util.class); + public static Logger log = Logger.getLogger(RunnerUtil.class); public static synchronized RunnerConfig getSupportedOptions( Class> clazz) { @@ -75,7 +76,7 @@ public final class Util { throws UnknownFileFormatException, IOException, FileNotFoundException, NullPointerException { assert !compbio.util.Util.isEmpty(workDirectory); assert !compbio.util.Util.isEmpty(clustFile); - File cfile = new File(compbio.engine.client.Util.getFullPath(workDirectory, clustFile)); + File cfile = new File(EngineUtil.getFullPath(workDirectory, clustFile)); log.trace("CLUSTAL OUTPUT FILE PATH: " + cfile.getAbsolutePath()); if (!(cfile.exists() && cfile.length() > 0)) { throw new FileNotFoundException("Result for the jobId " + workDirectory + " with file name " + clustFile + " is not found!"); @@ -88,8 +89,7 @@ public final class Util { FileNotFoundException, NullPointerException { assert !compbio.util.Util.isEmpty(workDirectory); assert !compbio.util.Util.isEmpty(clustFile); - File cfile = new File(compbio.engine.client.Util.getFullPath( - workDirectory, clustFile)); + File cfile = new File(EngineUtil.getFullPath(workDirectory, clustFile)); log.trace("Jronn OUTPUT FILE PATH: " + cfile.getAbsolutePath()); if (!(cfile.exists() && cfile.length() > 0)) { throw new FileNotFoundException("Result for the jobId " + workDirectory + " with file name " + clustFile + " is not found!"); @@ -131,9 +131,9 @@ public final class Util { assert !compbio.util.Util.isEmpty(workDirectory); assert !compbio.util.Util.isEmpty(structFile); // The stdout from RNAalifold - File sFile = new File(compbio.engine.client.Util.getFullPath( workDirectory, structFile)); + File sFile = new File(EngineUtil.getFullPath( workDirectory, structFile)); // Base pair probability matrix (-p option) - File aliFile = new File(compbio.engine.client.Util.getFullPath( workDirectory, "alifold.out")); + File aliFile = new File(EngineUtil.getFullPath( workDirectory, "alifold.out")); // Check that stdout file exists if(!(sFile.exists() && sFile.length() > 0)) { throw new FileNotFoundException("Result for the jobId " + workDirectory + "with file name " + structFile + " is not found!"); diff --git a/runner/compbio/runner/conservation/AACon.java b/runner/compbio/runner/conservation/AACon.java index d34bb09..9ff6549 100644 --- a/runner/compbio/runner/conservation/AACon.java +++ b/runner/compbio/runner/conservation/AACon.java @@ -33,6 +33,7 @@ import compbio.data.sequence.SequenceUtil; import compbio.engine.client.CommandBuilder; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ResultNotAvailableException; /** @@ -99,7 +100,7 @@ public class AACon extends SkeletalExecutable { // no further actions is necessary return settings; } - return compbio.engine.client.Util.convertToAbsolute(settings); + return EngineUtil.convertToAbsolute(settings); } @Override diff --git a/runner/compbio/runner/disorder/Disembl.java b/runner/compbio/runner/disorder/Disembl.java index 46b2e5c..b6453a7 100644 --- a/runner/compbio/runner/disorder/Disembl.java +++ b/runner/compbio/runner/disorder/Disembl.java @@ -28,7 +28,7 @@ import compbio.data.sequence.UnknownFileFormatException; import compbio.engine.client.PipedExecutable; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; /** * DisEMBL.py smooth_frame peak_frame join_frame fold_coils fold_hotloops diff --git a/runner/compbio/runner/disorder/GlobPlot.java b/runner/compbio/runner/disorder/GlobPlot.java index a20a8d2..2cb5953 100644 --- a/runner/compbio/runner/disorder/GlobPlot.java +++ b/runner/compbio/runner/disorder/GlobPlot.java @@ -28,7 +28,7 @@ import compbio.data.sequence.UnknownFileFormatException; import compbio.engine.client.PipedExecutable; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; /** * ./GlobPipe.py SmoothFrame DOMjoinFrame DOMpeakFrame DISjoinFrame DISpeakFrame diff --git a/runner/compbio/runner/disorder/Jronn.java b/runner/compbio/runner/disorder/Jronn.java index 55a1868..b123996 100644 --- a/runner/compbio/runner/disorder/Jronn.java +++ b/runner/compbio/runner/disorder/Jronn.java @@ -35,7 +35,7 @@ import compbio.engine.client.CommandBuilder; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.engine.client.EngineUtil; /** * Command line @@ -99,7 +99,7 @@ public class Jronn extends SkeletalExecutable { // no further actions is necessary return settings; } - return compbio.engine.client.Util.convertToAbsolute(settings); + return EngineUtil.convertToAbsolute(settings); } @Override diff --git a/runner/compbio/runner/msa/ClustalO.java b/runner/compbio/runner/msa/ClustalO.java index da35cee..046a84a 100644 --- a/runner/compbio/runner/msa/ClustalO.java +++ b/runner/compbio/runner/msa/ClustalO.java @@ -31,7 +31,7 @@ import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; import compbio.engine.client.Executable.ExecProvider; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; public class ClustalO extends SkeletalExecutable { @@ -84,7 +84,7 @@ public class ClustalO extends SkeletalExecutable { public Alignment getResults(String workDirectory) throws ResultNotAvailableException { try { - return Util.readClustalFile(workDirectory, getOutput()); + return RunnerUtil.readClustalFile(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); throw new ResultNotAvailableException(e); diff --git a/runner/compbio/runner/msa/ClustalW.java b/runner/compbio/runner/msa/ClustalW.java index a3bab89..2ce0d03 100644 --- a/runner/compbio/runner/msa/ClustalW.java +++ b/runner/compbio/runner/msa/ClustalW.java @@ -29,7 +29,7 @@ import compbio.data.sequence.Alignment; import compbio.data.sequence.UnknownFileFormatException; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; public class ClustalW extends SkeletalExecutable { @@ -67,7 +67,7 @@ public class ClustalW extends SkeletalExecutable { public Alignment getResults(String workDirectory) throws ResultNotAvailableException { try { - return Util.readClustalFile(workDirectory, getOutput()); + return RunnerUtil.readClustalFile(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); throw new ResultNotAvailableException(e); diff --git a/runner/compbio/runner/msa/Mafft.java b/runner/compbio/runner/msa/Mafft.java index fb5ca60..6a43d35 100644 --- a/runner/compbio/runner/msa/Mafft.java +++ b/runner/compbio/runner/msa/Mafft.java @@ -31,7 +31,7 @@ import compbio.data.sequence.UnknownFileFormatException; import compbio.engine.client.PipedExecutable; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; /** * @@ -64,7 +64,7 @@ public class Mafft extends SkeletalExecutable implements PipedExecutable< public Alignment getResults(String workDirectory) throws ResultNotAvailableException { try { - return Util.readClustalFile(workDirectory, getOutput()); + return RunnerUtil.readClustalFile(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); throw new ResultNotAvailableException(e); diff --git a/runner/compbio/runner/msa/Muscle.java b/runner/compbio/runner/msa/Muscle.java index 20c76ac..8576a04 100644 --- a/runner/compbio/runner/msa/Muscle.java +++ b/runner/compbio/runner/msa/Muscle.java @@ -31,7 +31,7 @@ import compbio.data.sequence.Alignment; import compbio.data.sequence.UnknownFileFormatException; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; public class Muscle extends SkeletalExecutable { @@ -83,7 +83,7 @@ public class Muscle extends SkeletalExecutable { public Alignment getResults(String workDirectory) throws ResultNotAvailableException { try { - return Util.readClustalFile(workDirectory, getOutput()); + return RunnerUtil.readClustalFile(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); throw new ResultNotAvailableException(e); diff --git a/runner/compbio/runner/msa/Probcons.java b/runner/compbio/runner/msa/Probcons.java index c4f2015..872a5f8 100644 --- a/runner/compbio/runner/msa/Probcons.java +++ b/runner/compbio/runner/msa/Probcons.java @@ -30,7 +30,7 @@ import compbio.data.sequence.UnknownFileFormatException; import compbio.engine.client.PipedExecutable; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; public class Probcons extends SkeletalExecutable implements @@ -57,7 +57,7 @@ public class Probcons extends SkeletalExecutable public Alignment getResults(String workDirectory) throws ResultNotAvailableException { try { - return Util.readClustalFile(workDirectory, getOutput()); + return RunnerUtil.readClustalFile(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); throw new ResultNotAvailableException(e); diff --git a/runner/compbio/runner/msa/Tcoffee.java b/runner/compbio/runner/msa/Tcoffee.java index 7108bec..e7f4988 100644 --- a/runner/compbio/runner/msa/Tcoffee.java +++ b/runner/compbio/runner/msa/Tcoffee.java @@ -33,7 +33,7 @@ import compbio.engine.client.PipedExecutable; import compbio.engine.client.SkeletalExecutable; import compbio.engine.conf.PropertyHelperManager; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.util.PropertyHelper; public class Tcoffee extends SkeletalExecutable @@ -81,7 +81,7 @@ public class Tcoffee extends SkeletalExecutable public Alignment getResults(String workDirectory) throws ResultNotAvailableException { try { - return Util.readClustalFile(workDirectory, getOutput()); + return RunnerUtil.readClustalFile(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); throw new ResultNotAvailableException(e); diff --git a/runner/compbio/runner/structure/RNAalifold.java b/runner/compbio/runner/structure/RNAalifold.java index 996e7d8..c0a50fe 100644 --- a/runner/compbio/runner/structure/RNAalifold.java +++ b/runner/compbio/runner/structure/RNAalifold.java @@ -9,7 +9,7 @@ import compbio.data.sequence.RNAStructScoreManager; import compbio.engine.client.PipedExecutable; import compbio.engine.client.SkeletalExecutable; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; public class RNAalifold extends SkeletalExecutable implements PipedExecutable { @@ -48,7 +48,7 @@ public class RNAalifold extends SkeletalExecutable public RNAStructScoreManager getResults(String workDirectory) throws ResultNotAvailableException { try { - return Util.readRNAStruct(workDirectory, getOutput()); + return RunnerUtil.readRNAStruct(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); throw new ResultNotAvailableException(e); diff --git a/testsrc/compbio/engine/cluster/drmaa/DrmaaClusterEngineTester.java b/testsrc/compbio/engine/cluster/drmaa/DrmaaClusterEngineTester.java index 447ccd3..c8998c7 100644 --- a/testsrc/compbio/engine/cluster/drmaa/DrmaaClusterEngineTester.java +++ b/testsrc/compbio/engine/cluster/drmaa/DrmaaClusterEngineTester.java @@ -34,7 +34,7 @@ import compbio.data.sequence.Alignment; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.metadata.AllTestSuit; import compbio.metadata.JobExecutionException; import compbio.metadata.JobStatus; @@ -77,20 +77,20 @@ public class DrmaaClusterEngineTester { status == JobStatus.PENDING || status == JobStatus.RUNNING); JobInfo info = runner.getJobInfo(); - assertFalse(Util.isMarked(confClust.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.CANCELLED)); - assertFalse(Util.isMarked(confClust.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.STARTED)); - assertFalse(Util.isMarked(confClust.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.COLLECTED)); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.FINISHED)); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.SUBMITTED)); ConfiguredExecutable confExec = runner.waitForResult(); // At this point results are marked as collected - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.COLLECTED)); assertNotNull("JobInfo is null", info); @@ -102,7 +102,7 @@ public class DrmaaClusterEngineTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits) .intValue(); assertEquals("Exit status is not 0", 0, exitsInt); System.out.println(sm.getAllStats()); @@ -162,15 +162,15 @@ public class DrmaaClusterEngineTester { runner.cancelJob(); Thread.sleep(200); // give fs time to write a file JobInfo info = runner.getJobInfo(); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.CANCELLED)); - assertFalse(Util.isMarked(confClust.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.STARTED)); - assertFalse(Util.isMarked(confClust.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.COLLECTED)); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.FINISHED)); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.SUBMITTED)); } catch (JobSubmissionException e) { diff --git a/testsrc/compbio/engine/cluster/drmaa/UtilTester.java b/testsrc/compbio/engine/cluster/drmaa/UtilTester.java index 07dcd1d..d8bf470 100644 --- a/testsrc/compbio/engine/cluster/drmaa/UtilTester.java +++ b/testsrc/compbio/engine/cluster/drmaa/UtilTester.java @@ -26,24 +26,24 @@ import java.text.ParseException; import org.testng.annotations.Test; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; public class UtilTester { @Test public void testParser() { try { - Number n = ClusterUtil.CLUSTER_STAT_IN_SEC.parse("11.0000"); + Number n = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse("11.0000"); assertNotNull(n); int t = n.intValue(); assertEquals(11, t); - n = ClusterUtil.CLUSTER_STAT_IN_SEC.parse("11.2300"); + n = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse("11.2300"); assertNotNull(n); t = n.intValue(); assertEquals(11, t); float f = n.floatValue(); assertEquals(11.23f, f); - n = ClusterUtil.CLUSTER_STAT_IN_SEC.parse("0.0310"); + n = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse("0.0310"); assertNotNull(n); f = n.floatValue(); assertEquals(0.031f, f); diff --git a/testsrc/compbio/engine/local/AsyncLocalRunnerTester.java b/testsrc/compbio/engine/local/AsyncLocalRunnerTester.java index c4cbe0e..271d0e9 100644 --- a/testsrc/compbio/engine/local/AsyncLocalRunnerTester.java +++ b/testsrc/compbio/engine/local/AsyncLocalRunnerTester.java @@ -35,7 +35,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.metadata.AllTestSuit; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -276,15 +276,15 @@ public class AsyncLocalRunnerTester { Executable clustalr = lr.getResults(jobId); assertNotNull(clustalr); - assertTrue(Util.isMarked(confClustal1.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(), JobStatus.CANCELLED)); - assertTrue(Util.isMarked(confClustal1.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(), JobStatus.STARTED)); - assertTrue(Util.isMarked(confClustal1.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(), JobStatus.COLLECTED)); - assertTrue(Util.isMarked(confClustal1.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(), JobStatus.FINISHED)); - assertFalse(Util.isMarked(confClustal1.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confClustal1.getWorkDirectory(), JobStatus.SUBMITTED)); } catch (JobSubmissionException e) { e.printStackTrace(); @@ -322,15 +322,15 @@ public class AsyncLocalRunnerTester { assertNotNull(muscler); Alignment al1 = muscler.getResults(); - assertTrue(Util.isMarked(muscler.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(muscler.getWorkDirectory(), JobStatus.STARTED)); - assertTrue(Util.isMarked(muscler.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(muscler.getWorkDirectory(), JobStatus.COLLECTED)); - assertTrue(Util.isMarked(muscler.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(muscler.getWorkDirectory(), JobStatus.FINISHED)); - assertFalse(Util.isMarked(muscler.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(muscler.getWorkDirectory(), JobStatus.CANCELLED)); - assertFalse(Util.isMarked(muscler.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(muscler.getWorkDirectory(), JobStatus.SUBMITTED)); Alignment al2 = confMuscle.getResults(); assertNotNull(al1); @@ -369,16 +369,16 @@ public class AsyncLocalRunnerTester { as.cancelJob(jobId); assertTrue(as.getJobStatus(jobId) == JobStatus.CANCELLED); - assertTrue(Util.isMarked(confMuscle.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confMuscle.getWorkDirectory(), JobStatus.CANCELLED)); // could be both // assertFalse(Util.isMarked(confMuscle.getWorkDirectory(), // Util.StatFileType.STARTED)); - assertFalse(Util.isMarked(confMuscle.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confMuscle.getWorkDirectory(), JobStatus.COLLECTED)); - assertFalse(Util.isMarked(confMuscle.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confMuscle.getWorkDirectory(), JobStatus.FINISHED)); - assertFalse(Util.isMarked(confMuscle.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confMuscle.getWorkDirectory(), JobStatus.SUBMITTED)); // Executable muscler = as.getResult(jobId); // assertNotNull(muscler); diff --git a/testsrc/compbio/engine/local/LocalRunnerTester.java b/testsrc/compbio/engine/local/LocalRunnerTester.java index bee74b4..13dfed0 100644 --- a/testsrc/compbio/engine/local/LocalRunnerTester.java +++ b/testsrc/compbio/engine/local/LocalRunnerTester.java @@ -31,7 +31,7 @@ import org.testng.annotations.Test; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.metadata.AllTestSuit; import compbio.metadata.JobExecutionException; import compbio.metadata.JobStatus; @@ -64,15 +64,15 @@ public class LocalRunnerTester { lr.cancelJob(); // This call causes CancellationException to be thrown Executable clustalr = lr.waitForResult(); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.CANCELLED)); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.STARTED)); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.COLLECTED)); - assertTrue(Util.isMarked(confClust.getWorkDirectory(), + assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.FINISHED)); - assertFalse(Util.isMarked(confClust.getWorkDirectory(), + assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(), JobStatus.SUBMITTED)); } catch (JobSubmissionException e) { e.printStackTrace(); diff --git a/testsrc/compbio/runner/conservation/AAConTester.java b/testsrc/compbio/runner/conservation/AAConTester.java index b453eb7..825de0b 100644 --- a/testsrc/compbio/runner/conservation/AAConTester.java +++ b/testsrc/compbio/runner/conservation/AAConTester.java @@ -48,7 +48,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.LocalRunner; @@ -62,7 +62,7 @@ import compbio.metadata.Preset; import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.util.FileWatcher; import compbio.util.SysPrefs; @@ -98,7 +98,7 @@ public class AAConTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); @@ -191,7 +191,7 @@ public class AAConTester { @Test(groups = {AllTestSuit.test_group_runner}) public void RunLocallyWithPreset() { try { - PresetManager aaconPresets = Util.getPresets(AACon.class); + PresetManager aaconPresets = RunnerUtil.getPresets(AACon.class); assert aaconPresets != null; ConfiguredExecutable confAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Local); Preset quick = aaconPresets.getPresetByName("Quick conservation"); diff --git a/testsrc/compbio/runner/disorder/DisemblTester.java b/testsrc/compbio/runner/disorder/DisemblTester.java index 6ea203c..de206d0 100644 --- a/testsrc/compbio/runner/disorder/DisemblTester.java +++ b/testsrc/compbio/runner/disorder/DisemblTester.java @@ -51,7 +51,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.LocalRunner; @@ -106,7 +106,7 @@ public class DisemblTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits) .intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); diff --git a/testsrc/compbio/runner/disorder/GlobPlotTester.java b/testsrc/compbio/runner/disorder/GlobPlotTester.java index b32e8d4..aef8de2 100644 --- a/testsrc/compbio/runner/disorder/GlobPlotTester.java +++ b/testsrc/compbio/runner/disorder/GlobPlotTester.java @@ -49,7 +49,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.LocalRunner; @@ -102,7 +102,7 @@ public class GlobPlotTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits) .intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); diff --git a/testsrc/compbio/runner/disorder/IUPredTester.java b/testsrc/compbio/runner/disorder/IUPredTester.java index 242e90e..f521154 100644 --- a/testsrc/compbio/runner/disorder/IUPredTester.java +++ b/testsrc/compbio/runner/disorder/IUPredTester.java @@ -49,7 +49,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.LocalRunner; @@ -101,7 +101,7 @@ public class IUPredTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits) .intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); diff --git a/testsrc/compbio/runner/disorder/JronnTester.java b/testsrc/compbio/runner/disorder/JronnTester.java index a3e0905..d0cadaa 100644 --- a/testsrc/compbio/runner/disorder/JronnTester.java +++ b/testsrc/compbio/runner/disorder/JronnTester.java @@ -49,7 +49,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.LocalRunner; @@ -95,7 +95,7 @@ public class JronnTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); assertEquals(0, exitsInt); //System.out.println(sm.getAllStats()); } catch (ParseException e) { diff --git a/testsrc/compbio/runner/msa/ClustalOTester.java b/testsrc/compbio/runner/msa/ClustalOTester.java index 9712ef8..d50e0fa 100644 --- a/testsrc/compbio/runner/msa/ClustalOTester.java +++ b/testsrc/compbio/runner/msa/ClustalOTester.java @@ -44,13 +44,13 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.FilePuller; import compbio.engine.SyncExecutor; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.Executable.ExecProvider; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.conf.RunnerConfigMarshaller; @@ -244,7 +244,7 @@ public class ClustalOTester { AsyncExecutor sexec = Configurator.getAsyncEngine(confal); String jobId = sexec.submitJob(confal); - String file = Util.getFullPath(confal.getWorkDirectory(), ClustalW.getStatFile()); + String file = EngineUtil.getFullPath(confal.getWorkDirectory(), ClustalW.getStatFile()); FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES); int count = 0; long position = 0; @@ -302,7 +302,7 @@ public class ClustalOTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); } catch (ParseException e) { @@ -336,7 +336,7 @@ public class ClustalOTester { AsyncExecutor sexec = Configurator.getAsyncEngine(confClustal); String jobId = sexec.submitJob(confClustal); - String file = Util.getFullPath(confClustal.getWorkDirectory(), ClustalW.getStatFile()); + String file = EngineUtil.getFullPath(confClustal.getWorkDirectory(), ClustalW.getStatFile()); FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES); int count = 0; long position = 0; diff --git a/testsrc/compbio/runner/msa/ClustalWTester.java b/testsrc/compbio/runner/msa/ClustalWTester.java index 44f5ec0..e6f7ac9 100644 --- a/testsrc/compbio/runner/msa/ClustalWTester.java +++ b/testsrc/compbio/runner/msa/ClustalWTester.java @@ -52,7 +52,7 @@ import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; import compbio.engine.client.Executable.ExecProvider; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.conf.RunnerConfigMarshaller; @@ -69,7 +69,7 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.runner.OptionCombinator; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.msa.ClustalW; import compbio.util.FileWatcher; import compbio.util.SysPrefs; @@ -228,7 +228,7 @@ public class ClustalWTester { ConfiguredExecutable confClustal; try { confClustal = Configurator.configureExecutable(cl); - Util.writeInput(seqs, confClustal); + RunnerUtil.writeInput(seqs, confClustal); LocalRunner lr = new LocalRunner(confClustal); lr.executeJob(); @@ -387,7 +387,7 @@ public class ClustalWTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); } catch (ParseException e) { diff --git a/testsrc/compbio/runner/msa/MafftTester.java b/testsrc/compbio/runner/msa/MafftTester.java index c111121..4d85bd5 100644 --- a/testsrc/compbio/runner/msa/MafftTester.java +++ b/testsrc/compbio/runner/msa/MafftTester.java @@ -294,7 +294,7 @@ public class MafftTester { AsyncExecutor sexec = Configurator.getAsyncEngine(cmafft, ExecProvider.Local); String jobId = sexec.submitJob(cmafft); - FilePuller fw = FilePuller.newFilePuller(compbio.engine.client.Util + FilePuller fw = FilePuller.newFilePuller(compbio.engine.client.EngineUtil .getFullPath(cmafft.getWorkDirectory(), cmafft.getError()), 256); int count = 0; diff --git a/testsrc/compbio/runner/msa/MuscleTester.java b/testsrc/compbio/runner/msa/MuscleTester.java index 954cd4f..dc45ca5 100644 --- a/testsrc/compbio/runner/msa/MuscleTester.java +++ b/testsrc/compbio/runner/msa/MuscleTester.java @@ -47,7 +47,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.LocalRunner; @@ -104,7 +104,7 @@ public class MuscleTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits) .intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); diff --git a/testsrc/compbio/runner/msa/ProbconsTester.java b/testsrc/compbio/runner/msa/ProbconsTester.java index 361aae2..afdc1b6 100644 --- a/testsrc/compbio/runner/msa/ProbconsTester.java +++ b/testsrc/compbio/runner/msa/ProbconsTester.java @@ -199,7 +199,7 @@ public class ProbconsTester { Executable.ExecProvider.Local); AsyncExecutor sexec = Configurator.getAsyncEngine(cprobs); String jobId = sexec.submitJob(cprobs); - FilePuller fw = FilePuller.newFilePuller(compbio.engine.client.Util + FilePuller fw = FilePuller.newFilePuller(compbio.engine.client.EngineUtil .getFullPath(cprobs.getWorkDirectory(), cprobs.getError()), 256); ConfiguredExecutable al = sexec.getResults(jobId); diff --git a/testsrc/compbio/runner/msa/TcoffeeParametersTester.java b/testsrc/compbio/runner/msa/TcoffeeParametersTester.java index 70ba1f4..9565f82 100644 --- a/testsrc/compbio/runner/msa/TcoffeeParametersTester.java +++ b/testsrc/compbio/runner/msa/TcoffeeParametersTester.java @@ -61,9 +61,9 @@ public class TcoffeeParametersTester { log.setLevel(Level.INFO); } - RunnerConfig tcoffeeConfig = compbio.runner.Util.getSupportedOptions(Tcoffee.class); + RunnerConfig tcoffeeConfig = compbio.runner.RunnerUtil.getSupportedOptions(Tcoffee.class); OptionCombinator tcoffeeOpc = null; - PresetManager presets = compbio.runner.Util.getPresets(Tcoffee.class); + PresetManager presets = compbio.runner.RunnerUtil.getPresets(Tcoffee.class); @BeforeMethod(groups = { AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows }) diff --git a/testsrc/compbio/runner/predictors/JpredTester.java b/testsrc/compbio/runner/predictors/JpredTester.java index b1b991f..1bf753b 100644 --- a/testsrc/compbio/runner/predictors/JpredTester.java +++ b/testsrc/compbio/runner/predictors/JpredTester.java @@ -47,7 +47,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.LocalRunner; @@ -61,7 +61,7 @@ import compbio.metadata.Preset; import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.util.FileWatcher; import compbio.util.SysPrefs; @@ -85,7 +85,7 @@ public class JpredTester { public void RunOnCluster() { assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment"); try { - PresetManager jpredPreset = Util.getPresets(Jpred.class); + PresetManager jpredPreset = RunnerUtil.getPresets(Jpred.class); assert jpredPreset != null; ConfiguredExecutable confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Cluster); Preset conf = jpredPreset.getPresetByName("cluster configuration"); @@ -104,7 +104,7 @@ public class JpredTester { String exits = sm.getExitStatus(); assertNotNull("Exit status is null", exits); // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); + int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue(); assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); } catch (ParseException e) { @@ -194,7 +194,7 @@ public class JpredTester { public void RunLocallyWithPreset() { try { ConfiguredExecutable confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Local); - PresetManager preset = Util.getPresets(Jpred.class); + PresetManager preset = RunnerUtil.getPresets(Jpred.class); assert preset != null; Preset conf = preset.getPresetByName("laptop configuration"); confpred.addParameters(conf.getOptions()); @@ -227,7 +227,7 @@ public class JpredTester { jpred.setInput(test_input); jpred.setOutput(test_output); ConfiguredExecutable confpred = Configurator.configureExecutable(jpred, Executable.ExecProvider.Local); - PresetManager preset = Util.getPresets(Jpred.class); + PresetManager preset = RunnerUtil.getPresets(Jpred.class); assert preset != null; Preset conf = preset.getPresetByName("laptop configuration"); confpred.addParameters(conf.getOptions()); diff --git a/testsrc/compbio/runner/structure/RNAalifoldTester.java b/testsrc/compbio/runner/structure/RNAalifoldTester.java index 0249215..3f0986f 100644 --- a/testsrc/compbio/runner/structure/RNAalifoldTester.java +++ b/testsrc/compbio/runner/structure/RNAalifoldTester.java @@ -34,7 +34,7 @@ import compbio.engine.client.ConfExecutable; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.RunConfiguration; -import compbio.engine.cluster.drmaa.ClusterUtil; +import compbio.engine.cluster.drmaa.ClusterEngineUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.engine.local.AsyncLocalRunner; diff --git a/webservices/compbio/stat/servlet/ServiceStatus.java b/webservices/compbio/stat/servlet/ServiceStatus.java index 01b538f..c31f15d 100644 --- a/webservices/compbio/stat/servlet/ServiceStatus.java +++ b/webservices/compbio/stat/servlet/ServiceStatus.java @@ -33,10 +33,14 @@ public class ServiceStatus extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - StringBuffer jabawspath = req.getRequestURL(); jabawspath = jabawspath.delete(jabawspath.lastIndexOf("/"), jabawspath.length()); String serverPath = jabawspath.toString(); + System.out.println("Testing services at " + serverPath); + System.out.println(" Context Path is " + req.getContextPath()); + System.out.println(" Request URI is " + req.getRequestURI()); + System.out.println(" Servlet Path is " + req.getServletPath()); + System.out.println(" Path Info is " + req.getPathInfo()); List testResults = new ArrayList(); diff --git a/webservices/compbio/stat/servlet/StatisticCollector.java b/webservices/compbio/stat/servlet/StatisticCollector.java index 8a01122..e305fa5 100644 --- a/webservices/compbio/stat/servlet/StatisticCollector.java +++ b/webservices/compbio/stat/servlet/StatisticCollector.java @@ -28,6 +28,7 @@ import javax.servlet.ServletContextListener; import org.apache.log4j.Logger; import compbio.engine.conf.PropertyHelperManager; +import compbio.engine.client.EngineUtil; import compbio.stat.collector.ExecutionStatCollector; import compbio.stat.collector.StatDB; import compbio.util.PropertyHelper; @@ -68,7 +69,7 @@ public class StatisticCollector implements ServletContextListener { int clusterMaxRuntime = getClusterJobTimeOut(); int localMaxRuntime = getLocalJobTimeOut(); - String localWorkDir = compbio.engine.client.Util.convertToAbsolute(getLocalJobDir()); + String localWorkDir = EngineUtil.convertToAbsolute(getLocalJobDir()); log.info("Initializing statistics collectors"); executor = Executors.newScheduledThreadPool(2); diff --git a/webservices/compbio/ws/client/WSTester.java b/webservices/compbio/ws/client/WSTester.java index edf186c..928288c 100644 --- a/webservices/compbio/ws/client/WSTester.java +++ b/webservices/compbio/ws/client/WSTester.java @@ -28,9 +28,13 @@ import java.io.Closeable; import java.io.IOException; import java.io.PrintWriter; import java.net.ConnectException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Arrays; import java.util.List; +import java.util.logging.Level; +import javax.xml.ws.Service; import javax.xml.ws.WebServiceException; import compbio.data.msa.JABAService; @@ -256,7 +260,7 @@ public class WSTester { private boolean testSequenceAnnotationWS( SequenceAnnotation wservice, Services service) throws Exception { - writer.print("Calling analyse........."); + writer.print("Calling annotation test........."); List input = loadSeqs(2); if (service == Services.AAConWS ) { @@ -304,8 +308,7 @@ public class WSTester { private void reportException(Exception e) { writer.println(FAILED); - writer.println("Exception while waiting for results. " - + "Exception details are below:"); + writer.println("Exception while waiting for results. Exception details are below:"); writer.println(e.getLocalizedMessage()); e.printStackTrace(writer); } @@ -429,6 +432,44 @@ public class WSTester { } } + + /** + * Connects to a web service by the host and the service name web service type + * + * @param host + * the fully qualified name of JABAWS server including JABAWS + * context name e.g + * http://nanna.cluster.lifesci.dundee.ac.uk:8080/jaba + * @param service + * the name of the JABAWS service to connect to + * @return JABAService + * @throws WebServiceException + * @throws ConnectException + * if fails to connect to the service on the host + */ + private JABAService connect(String host, Services service) + throws WebServiceException, ConnectException { + URL url = null; + System.out.println ("Attempting to connect with " + service.toString() + "..."); + try { + url = new URL(host + "/" + service.toString() + "?wsdl"); + System.out.println ("URL: " + url.toString()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + Service serv = null; + try { + serv = service.getService(url, service.getServiceNamespace()); + } catch (WebServiceException wse) { + wse.printStackTrace(); + } + if (serv == null) { + throw new ConnectException("Could not connect to " + url + ". Is the server down?"); + } + JABAService srv = service.getInterface(serv); + System.out.println ("Connected successfully!"); + return srv; + } /** * Test JABA web service @@ -441,7 +482,7 @@ public class WSTester { */ public boolean checkService(Services service) throws ConnectException, WebServiceException { - JABAService ws = Jws2Client.connect(hostname, service); + JABAService ws = connect(hostname, service); if (ws == null) { String line = "Cannot estabilish the connection to host " + hostname + " with service "; writer.println(line + service.toString()); diff --git a/webservices/compbio/ws/server/ClustalOWS.java b/webservices/compbio/ws/server/ClustalOWS.java index 2681364..1d8e9b6 100644 --- a/webservices/compbio/ws/server/ClustalOWS.java +++ b/webservices/compbio/ws/server/ClustalOWS.java @@ -35,6 +35,7 @@ import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -46,19 +47,16 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.WrongParameterException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.msa.ClustalO; @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "ClustalOWS") public class ClustalOWS implements MsaWS { private static Logger log = Logger.getLogger(ClustalOWS.class); - - private static final RunnerConfig clustalOptions = Util.getSupportedOptions(ClustalO.class); - - private static final PresetManager clustalPresets = Util.getPresets(ClustalO.class); - - private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new ClustalO().getType()); + private static final RunnerConfig clustalOptions = RunnerUtil.getSupportedOptions(ClustalO.class); + private static final PresetManager clustalPresets = RunnerUtil.getPresets(ClustalO.class); + private static final LimitsManager limitMan = EngineUtil.getLimits(new ClustalO().getType()); @Override public String align(List sequences) diff --git a/webservices/compbio/ws/server/ClustalWS.java b/webservices/compbio/ws/server/ClustalWS.java index ce12c6a..9799bd7 100644 --- a/webservices/compbio/ws/server/ClustalWS.java +++ b/webservices/compbio/ws/server/ClustalWS.java @@ -34,6 +34,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -45,19 +46,16 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.WrongParameterException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.msa.ClustalW; @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "ClustalWS") public class ClustalWS implements MsaWS { private static Logger log = Logger.getLogger(ClustalWS.class); - - private static final RunnerConfig clustalOptions = Util.getSupportedOptions(ClustalW.class); - - private static final PresetManager clustalPresets = Util.getPresets(ClustalW.class); - - private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new ClustalW().getType()); + private static final RunnerConfig clustalOptions = RunnerUtil.getSupportedOptions(ClustalW.class); + private static final PresetManager clustalPresets = RunnerUtil.getPresets(ClustalW.class); + private static final LimitsManager limitMan = EngineUtil.getLimits(new ClustalW().getType()); @Override public String align(List sequences) diff --git a/webservices/compbio/ws/server/GAUtils.java b/webservices/compbio/ws/server/GAUtils.java index 53acc88..3bec5c7 100644 --- a/webservices/compbio/ws/server/GAUtils.java +++ b/webservices/compbio/ws/server/GAUtils.java @@ -24,8 +24,7 @@ public class GAUtils { // compbio.dundee.ac.uk GA tracker private static AnalyticsConfigData config = new AnalyticsConfigData("UA-5356328-1"); - private static GoogleAnalyticsTracker TRACKER = new GoogleAnalyticsTracker( - config); + private static GoogleAnalyticsTracker TRACKER = new GoogleAnalyticsTracker(config); static final boolean IS_GA_ENABLED = isGoogleAnalyticsEnabled(); @@ -73,9 +72,19 @@ public class GAUtils { } else { service_name = service.toString(); } - TRACKER.trackPageViewFromReferrer("JABAWS/2.0/" + service_name, - service_name, "http://www.compbio.dundee.ac.uk", - SERVER_ADDRESS, VERSION_TYPE); + TRACKER.trackPageViewFromReferrer("JABAWS/2.0/" + service_name, service_name, "http://www.compbio.dundee.ac.uk", SERVER_ADDRESS, VERSION_TYPE); TRACKER.resetSession(); } + + static void reportUsage(Services service, String CLIENT_ADDRESS) { + String service_name = "UNKNOWN"; + if (service == null) { + log.warn("GA: Services was NULL!"); + } else { + service_name = service.toString(); + } + TRACKER.trackPageViewFromReferrer("JABAWS/2.0/" + service_name, service_name, "http://www.compbio.dundee.ac.uk", CLIENT_ADDRESS, VERSION_TYPE); + TRACKER.resetSession(); + } + } diff --git a/webservices/compbio/ws/server/GenericMetadataService.java b/webservices/compbio/ws/server/GenericMetadataService.java index 4defd89..0b12fc4 100644 --- a/webservices/compbio/ws/server/GenericMetadataService.java +++ b/webservices/compbio/ws/server/GenericMetadataService.java @@ -26,6 +26,7 @@ import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -33,7 +34,7 @@ import compbio.metadata.Limit; import compbio.metadata.LimitsManager; import compbio.metadata.PresetManager; import compbio.metadata.RunnerConfig; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; public abstract class GenericMetadataService { @@ -52,9 +53,9 @@ public abstract class GenericMetadataService { assert exec != null; this.log = log; this.exec = exec; - this.limitMan = compbio.engine.client.Util.getLimits(exec.getType()); - this.aaconOptions = Util.getSupportedOptions((Class>) exec.getType()); - this.aaconPresets = Util.getPresets((Class>) exec.getType()); + this.limitMan = EngineUtil.getLimits(exec.getType()); + this.aaconOptions = RunnerUtil.getSupportedOptions((Class>) exec.getType()); + this.aaconPresets = RunnerUtil.getPresets((Class>) exec.getType()); } ConfiguredExecutable init(List sequences) diff --git a/webservices/compbio/ws/server/JpredWS.java b/webservices/compbio/ws/server/JpredWS.java index 18be1b8..6eb20e7 100644 --- a/webservices/compbio/ws/server/JpredWS.java +++ b/webservices/compbio/ws/server/JpredWS.java @@ -35,6 +35,7 @@ import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -46,7 +47,7 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.WrongParameterException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.predictors.Jpred; @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "JpredWS") @@ -54,9 +55,9 @@ public class JpredWS implements MsaWS { private static Logger log = Logger.getLogger(JpredWS.class); - private static final RunnerConfig jpredOptions = Util.getSupportedOptions(Jpred.class); - private static final PresetManager jpredPresets = Util.getPresets(Jpred.class); - private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new Jpred().getType()); + private static final RunnerConfig jpredOptions = RunnerUtil.getSupportedOptions(Jpred.class); + private static final PresetManager jpredPresets = RunnerUtil.getPresets(Jpred.class); + private static final LimitsManager limitMan = EngineUtil.getLimits(new Jpred().getType()); @Override public String align(List sequences) diff --git a/webservices/compbio/ws/server/MafftWS.java b/webservices/compbio/ws/server/MafftWS.java index 5ee6872..1d02e81 100644 --- a/webservices/compbio/ws/server/MafftWS.java +++ b/webservices/compbio/ws/server/MafftWS.java @@ -34,6 +34,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -45,22 +46,16 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.WrongParameterException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.msa.Mafft; @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "MafftWS") public class MafftWS implements MsaWS { private static Logger log = Logger.getLogger(MafftWS.class); - - private static final RunnerConfig mafftOptions = Util - .getSupportedOptions(Mafft.class); - - private static final PresetManager mafftPresets = Util - .getPresets(Mafft.class); - - private static final LimitsManager limitMan = compbio.engine.client.Util - .getLimits(new Mafft().getType()); + private static final RunnerConfig mafftOptions = RunnerUtil.getSupportedOptions(Mafft.class); + private static final PresetManager mafftPresets = RunnerUtil.getPresets(Mafft.class); + private static final LimitsManager limitMan = EngineUtil.getLimits(new Mafft().getType()); @Override public String align(List sequences) diff --git a/webservices/compbio/ws/server/MainManager.java b/webservices/compbio/ws/server/MainManager.java index 632ceeb..63267c7 100644 --- a/webservices/compbio/ws/server/MainManager.java +++ b/webservices/compbio/ws/server/MainManager.java @@ -32,6 +32,7 @@ import compbio.stat.collector.StatDB; import compbio.engine.conf.PropertyHelperManager; import compbio.engine.local.ExecutableWrapper; import compbio.engine.local.LocalExecutorService; +import compbio.engine.client.EngineUtil; import compbio.util.PropertyHelper; /** @@ -97,7 +98,7 @@ public class MainManager implements ServletContextListener { } // configure local cleaner - String localWorkDir = compbio.engine.client.Util.convertToAbsolute(getLocalJobDir()); + String localWorkDir = EngineUtil.convertToAbsolute(getLocalJobDir()); int localDirLiveSpan = PropertyHelperManager.getIntProperty(ph.getProperty("local.jobdir.maxlifespan")); int localCleaningRate = PropertyHelperManager.getIntProperty(ph.getProperty("local.jobdir.cleaning.frequency")); boolean cleanLocalDir = PropertyHelperManager.getBooleanProperty(ph.getProperty("local.stat.collector.enable")); diff --git a/webservices/compbio/ws/server/MuscleWS.java b/webservices/compbio/ws/server/MuscleWS.java index 1937a68..943b3c2 100644 --- a/webservices/compbio/ws/server/MuscleWS.java +++ b/webservices/compbio/ws/server/MuscleWS.java @@ -34,6 +34,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -45,22 +46,16 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.WrongParameterException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.msa.Muscle; @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "MuscleWS") public class MuscleWS implements MsaWS { private static Logger log = Logger.getLogger(MuscleWS.class); - - private static final RunnerConfig muscleOptions = Util - .getSupportedOptions(Muscle.class); - - private static final PresetManager musclePresets = Util - .getPresets(Muscle.class); - - private static final LimitsManager limitMan = compbio.engine.client.Util - .getLimits(new Muscle().getType()); + private static final RunnerConfig muscleOptions = RunnerUtil.getSupportedOptions(Muscle.class); + private static final PresetManager musclePresets = RunnerUtil.getPresets(Muscle.class); + private static final LimitsManager limitMan = EngineUtil.getLimits(new Muscle().getType()); @Override public String align(List sequences) @@ -91,8 +86,7 @@ public class MuscleWS implements MsaWS { List params = WSUtil.getCommands(options, Muscle.KEY_VALUE_SEPARATOR); confMuscle.addParameters(params); - return WSUtil.align(sequences, confMuscle, log, "customAlign", - getLimit("")); + return WSUtil.align(sequences, confMuscle, log, "customAlign", getLimit("")); } @Override diff --git a/webservices/compbio/ws/server/ProbconsWS.java b/webservices/compbio/ws/server/ProbconsWS.java index 087afc6..b688e14 100644 --- a/webservices/compbio/ws/server/ProbconsWS.java +++ b/webservices/compbio/ws/server/ProbconsWS.java @@ -34,6 +34,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -45,7 +46,7 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.WrongParameterException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.msa.Probcons; @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "ProbconsWS") @@ -53,8 +54,8 @@ public class ProbconsWS implements MsaWS { private static Logger log = Logger.getLogger(ProbconsWS.class); - private static final RunnerConfig probconsOptions = Util.getSupportedOptions(Probcons.class); - private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new Probcons().getType()); + private static final RunnerConfig probconsOptions = RunnerUtil.getSupportedOptions(Probcons.class); + private static final LimitsManager limitMan = EngineUtil.getLimits(new Probcons().getType()); @Override public String align(List sequences) diff --git a/webservices/compbio/ws/server/SetExecutableFlag.java b/webservices/compbio/ws/server/SetExecutableFlag.java index a04e547..dec7368 100644 --- a/webservices/compbio/ws/server/SetExecutableFlag.java +++ b/webservices/compbio/ws/server/SetExecutableFlag.java @@ -9,7 +9,7 @@ import javax.servlet.ServletContextListener; import org.apache.log4j.Logger; import compbio.engine.client.Executable.ExecProvider; -import compbio.engine.client.Util; +import compbio.engine.client.EngineUtil; import compbio.engine.conf.PropertyHelperManager; import compbio.runner.disorder.IUPred; import compbio.runner.msa.Muscle; @@ -42,9 +42,9 @@ public class SetExecutableFlag implements ServletContextListener { // Assume at least one of these is configured // Do not even bother with cluster execution, sysadmins set the flag // themselves - String command = Util.getCommand(ExecProvider.Local, Muscle.class); + String command = EngineUtil.getCommand(ExecProvider.Local, Muscle.class); if (compbio.util.Util.isEmpty(command)) { - command = Util.getCommand(ExecProvider.Local, IUPred.class); + command = EngineUtil.getCommand(ExecProvider.Local, IUPred.class); } boolean isExec = true; if (!compbio.util.Util.isEmpty(command)) { diff --git a/webservices/compbio/ws/server/TcoffeeWS.java b/webservices/compbio/ws/server/TcoffeeWS.java index 72291dc..ee1c1c6 100644 --- a/webservices/compbio/ws/server/TcoffeeWS.java +++ b/webservices/compbio/ws/server/TcoffeeWS.java @@ -35,6 +35,7 @@ import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -46,19 +47,16 @@ import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.WrongParameterException; -import compbio.runner.Util; +import compbio.runner.RunnerUtil; import compbio.runner.msa.Tcoffee; @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "TcoffeeWS") public class TcoffeeWS implements MsaWS { private static Logger log = Logger.getLogger(TcoffeeWS.class); - - private static final RunnerConfig tcoffeeOptions = Util.getSupportedOptions(Tcoffee.class); - - private static final PresetManager tcoffeePresets = Util.getPresets(Tcoffee.class); - - private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new Tcoffee().getType()); + private static final RunnerConfig tcoffeeOptions = RunnerUtil.getSupportedOptions(Tcoffee.class); + private static final PresetManager tcoffeePresets = RunnerUtil.getPresets(Tcoffee.class); + private static final LimitsManager limitMan = EngineUtil.getLimits(new Tcoffee().getType()); @Override public String align(List sequences) diff --git a/webservices/compbio/ws/server/WSUtil.java b/webservices/compbio/ws/server/WSUtil.java index d0c9226..835b553 100644 --- a/webservices/compbio/ws/server/WSUtil.java +++ b/webservices/compbio/ws/server/WSUtil.java @@ -31,6 +31,7 @@ import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.ProgressGetter; import compbio.engine.client.ConfiguredExecutable; +import compbio.engine.client.EngineUtil; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -45,31 +46,25 @@ public final class WSUtil { public static final void validateJobId(String jobId) throws InvalidParameterException { - if (!compbio.engine.client.Util.isValidJobId(jobId)) { - throw new InvalidParameterException( - "JobId is not provided or cannot be recognised! Given value: " - + jobId); + if (!EngineUtil.isValidJobId(jobId)) { + throw new InvalidParameterException("JobId is not provided or cannot be recognised! Given value: " + jobId); } } public static final void validateFastaInput(List sequences) throws JobSubmissionException { if (sequences == null || sequences.isEmpty()) { - throw new JobSubmissionException( - "List of fasta sequences required but not provided! "); + throw new JobSubmissionException("List of fasta sequences required but not provided! "); } Set names = new HashSet(); for (FastaSequence fs : sequences) { boolean unique = names.add(fs.getId()); if (!unique) { throw new JobSubmissionException( - "Input sequences must have unique names! \n" - + "Sequence " + fs.getId() + " is a duplicate!"); + "Input sequences must have unique names! \nSequence " + fs.getId() + " is a duplicate!"); } if (fs.getLength() == 0) { - throw new JobSubmissionException( - "Sequence must not be empty! Sequence: " + fs.getId() - + " was empty"); + throw new JobSubmissionException("Sequence must not be empty! Sequence: " + fs.getId() + " was empty"); } } } @@ -105,7 +100,7 @@ public final class WSUtil { if (limit != null && limit.isExceeded(sequences)) { throw LimitExceededException.newLimitExceeded(limit, sequences); } - compbio.runner.Util.writeInput(sequences, confExec); + compbio.runner.RunnerUtil.writeInput(sequences, confExec); AsyncExecutor engine = Configurator.getAsyncEngine(confExec); String jobId = engine.submitJob(confExec); reportUsage(confExec, logger); @@ -127,7 +122,7 @@ public final class WSUtil { if (limit != null && limit.isExceeded(sequences)) { throw LimitExceededException.newLimitExceeded(limit, sequences); } - compbio.runner.Util.writeInput(sequences, confExec); + compbio.runner.RunnerUtil.writeInput(sequences, confExec); AsyncExecutor engine = Configurator.getAsyncEngine(confExec); String jobId = engine.submitJob(confExec); reportUsage(confExec, log); @@ -144,7 +139,7 @@ public final class WSUtil { if (limit != null && limit.isExceeded(sequences)) { throw LimitExceededException.newLimitExceeded(limit, sequences); } - compbio.runner.Util.writeClustalInput(sequences, confExec, '-'); + compbio.runner.RunnerUtil.writeClustalInput(sequences, confExec, '-'); AsyncExecutor engine = Configurator.getAsyncEngine(confExec); String jobId = engine.submitJob(confExec); reportUsage(confExec, log);