import compbio.engine.client.Executable;\r
import compbio.engine.client.PathValidator;\r
import compbio.engine.client.EngineUtil;\r
-import compbio.engine.cluster.drmaa.AsyncJobRunner;\r
-import compbio.engine.cluster.drmaa.JobRunner;\r
+import compbio.engine.cluster.drmaa.AsyncClusterRunner;\r
+import compbio.engine.cluster.drmaa.ClusterRunner;\r
import compbio.engine.conf.DirectoryManager;\r
import compbio.engine.conf.PropertyHelperManager;\r
import compbio.engine.local.AsyncLocalRunner;\r
public final static String LOCAL_WORK_DIRECTORY = initLocalDirectory();\r
public final static String CLUSTER_WORK_DIRECTORY = initClusterWorkDirectory();\r
\r
-\r
-\r
private static boolean initBooleanValue(String key) {\r
assert key != null;\r
String status = ph.getProperty(key);\r
if (!Util.isEmpty(tmpDir)) {\r
tmpDir = tmpDir.trim();\r
} else {\r
- throw new RuntimeException(\r
- "Cluster work directory must be provided! ");\r
+ throw new RuntimeException("Cluster work directory must be provided! ");\r
}\r
- if (LOCAL_WORK_DIRECTORY != null\r
- && LOCAL_WORK_DIRECTORY.equals(CLUSTER_WORK_DIRECTORY)) {\r
- throw new InvalidParameterException(\r
- "Cluster engine output directory must be different of that for local engine!");\r
+ if (LOCAL_WORK_DIRECTORY != null && LOCAL_WORK_DIRECTORY.equals(CLUSTER_WORK_DIRECTORY)) {\r
+ throw new InvalidParameterException("Cluster engine output directory must be different of that for local engine!");\r
}\r
}\r
return tmpDir;\r
* {@link LoadBalancer} for an engine. This method will fall back and return\r
* local engine if\r
* \r
- * 1) No engines are defined in the properties or they have been defined\r
- * incorrectly\r
+ * 1) No engines are defined in the properties or they have been defined incorrectly\r
* \r
* 2) Execution environment is Windows as the system cannot really run\r
* cluster submission from windows\r
* @return SyncExecutor backed up by either cluster or local engines\r
* @throws JobSubmissionException\r
*/\r
- static Executable.ExecProvider getExecProvider(\r
- ConfiguredExecutable<?> executable, List<FastaSequence> dataSet)\r
+ static Executable.ExecProvider getExecProvider(ConfiguredExecutable<?> executable, List<FastaSequence> dataSet)\r
throws JobSubmissionException {\r
// Look where executable claims to be executed\r
Executable.ExecProvider provider = executable.getSupportedRuntimes();\r
if (!IS_CLUSTER_ENGINE_ENABLED && !IS_LOCAL_ENGINE_ENABLED) {\r
// Both engines disabled!\r
- throw new RuntimeException(\r
- "Both engines are disabled! "\r
- + "Check conf/Engine.cluster.properties and conf/Engine.local.properties. "\r
- + "At least one engine must be enabled!");\r
+ throw new RuntimeException("Both engines are disabled! "\r
+ + "Check conf/Engine.cluster.properties and conf/Engine.local.properties. At least one engine must be enabled!");\r
}\r
if (provider == Executable.ExecProvider.Local) {\r
if (IS_LOCAL_ENGINE_ENABLED) {\r
return Executable.ExecProvider.Local;\r
} else {\r
- throw new JobSubmissionException(\r
- "Executable can be executed only on locally, but local engine is disabled!");\r
+ throw new JobSubmissionException("Executable can be executed only on locally, but local engine is disabled!");\r
}\r
}\r
if (provider == Executable.ExecProvider.Cluster) {\r
if (IS_CLUSTER_ENGINE_ENABLED) {\r
return Executable.ExecProvider.Cluster;\r
} else {\r
- throw new JobSubmissionException(\r
- "Executable can be executed only on the cluster, but cluster engine is disabled!");\r
+ throw new JobSubmissionException("Executable can be executed only on the cluster, but cluster engine is disabled!");\r
}\r
}\r
// We are here if executable can be executed on both Cluster and Local\r
return Executable.ExecProvider.Local;\r
}\r
\r
- public static <T> ConfiguredExecutable<T> configureExecutable(\r
- Executable<T> executable) throws JobSubmissionException {\r
+ public static <T> ConfiguredExecutable<T> configureExecutable(Executable<T> executable) throws JobSubmissionException {\r
\r
- ConfExecutable<T> confExec = new ConfExecutable<T>(executable,\r
- DirectoryManager.getTaskDirectory(executable.getClass()));\r
+ ConfExecutable<T> confExec = new ConfExecutable<T>(executable, DirectoryManager.getTaskDirectory(executable.getClass()));\r
Executable.ExecProvider provider = getExecProvider(confExec, null);\r
confExec.setExecProvider(provider);\r
setupWorkDirectory(confExec, provider);\r
return confExec;\r
}\r
\r
- public static <T> ConfiguredExecutable<T> configureExecutable(\r
- Executable<T> executable, List<FastaSequence> dataSet)\r
+ public static <T> ConfiguredExecutable<T> configureExecutable(Executable<T> executable, List<FastaSequence> dataSet)\r
throws JobSubmissionException {\r
\r
- ConfExecutable<T> confExec = new ConfExecutable<T>(executable,\r
- DirectoryManager.getTaskDirectory(executable.getClass()));\r
+ ConfExecutable<T> confExec = new ConfExecutable<T>(executable, DirectoryManager.getTaskDirectory(executable.getClass()));\r
Executable.ExecProvider provider = getExecProvider(confExec, dataSet);\r
confExec.setExecProvider(provider);\r
setupWorkDirectory(confExec, provider);\r
return confExec;\r
}\r
\r
- static <T> void setupWorkDirectory(ConfExecutable<T> confExec,\r
- Executable.ExecProvider provider) {\r
+ static <T> void setupWorkDirectory(ConfExecutable<T> confExec, Executable.ExecProvider provider) {\r
assert provider != null && provider != Executable.ExecProvider.Any;\r
String workDir = "";\r
if (provider == Executable.ExecProvider.Local) {\r
- workDir = Configurator.LOCAL_WORK_DIRECTORY + File.separator\r
- + confExec.getTaskId();\r
+ workDir = Configurator.LOCAL_WORK_DIRECTORY + File.separator + confExec.getTaskId();\r
} else {\r
- workDir = Configurator.CLUSTER_WORK_DIRECTORY + File.separator\r
- + confExec.getTaskId();\r
+ workDir = Configurator.CLUSTER_WORK_DIRECTORY + File.separator + confExec.getTaskId();\r
}\r
// Create working directory for the task\r
File wdir = new File(workDir);\r
wdir.mkdir();\r
- log.info("Creating working directory for the task in: "\r
- + wdir.getAbsolutePath());\r
+ log.info("Creating working directory for the task in: " + wdir.getAbsolutePath());\r
// Tell the executable where to get the results\r
confExec.setWorkDirectory(workDir);\r
}\r
\r
- public static <T> ConfiguredExecutable<T> configureExecutable(\r
- Executable<T> executable, Executable.ExecProvider provider)\r
+ public static <T> ConfiguredExecutable<T> configureExecutable(Executable<T> executable, Executable.ExecProvider provider)\r
throws JobSubmissionException {\r
if (executable == null) {\r
throw new InvalidParameterException("Executable must be provided!");\r
}\r
- ConfExecutable<T> confExec = new ConfExecutable<T>(executable,\r
- DirectoryManager.getTaskDirectory(executable.getClass()));\r
- if (provider == Executable.ExecProvider.Cluster\r
- && !IS_CLUSTER_ENGINE_ENABLED) {\r
- throw new JobSubmissionException(\r
- "Cluster engine is disabled or not configured!");\r
+ ConfExecutable<T> confExec = new ConfExecutable<T>(executable, DirectoryManager.getTaskDirectory(executable.getClass()));\r
+ if (provider == Executable.ExecProvider.Cluster && !IS_CLUSTER_ENGINE_ENABLED) {\r
+ throw new JobSubmissionException("Cluster engine is disabled or not configured!");\r
}\r
- if (provider == Executable.ExecProvider.Local\r
- && !IS_LOCAL_ENGINE_ENABLED) {\r
- throw new JobSubmissionException(\r
- "Local engine is disabled or not configured!");\r
+ if (provider == Executable.ExecProvider.Local && !IS_LOCAL_ENGINE_ENABLED) {\r
+ throw new JobSubmissionException("Local engine is disabled or not configured!");\r
}\r
confExec.setExecProvider(provider);\r
setupWorkDirectory(confExec, provider);\r
return confExec;\r
}\r
\r
- public static AsyncExecutor getAsyncEngine(\r
- ConfiguredExecutable<?> executable, Executable.ExecProvider provider) {\r
+ public static AsyncExecutor getAsyncEngine(ConfiguredExecutable<?> executable, Executable.ExecProvider provider) {\r
\r
assert provider != Executable.ExecProvider.Any && provider != null;\r
if (provider == Executable.ExecProvider.Cluster) {\r
- return new AsyncJobRunner();\r
+ return new AsyncClusterRunner();\r
}\r
return new AsyncLocalRunner();\r
}\r
\r
- public static SyncExecutor getSyncEngine(\r
- ConfiguredExecutable<?> executable, Executable.ExecProvider provider)\r
+ public static SyncExecutor getSyncEngine(ConfiguredExecutable<?> executable, Executable.ExecProvider provider)\r
throws JobSubmissionException {\r
\r
assert provider != Executable.ExecProvider.Any && provider != null;\r
if (provider == Executable.ExecProvider.Cluster) {\r
- return JobRunner.getInstance(executable);\r
+ return ClusterRunner.getInstance(executable);\r
}\r
return new LocalRunner(executable);\r
}\r
\r
- public static AsyncExecutor getAsyncEngine(\r
- ConfiguredExecutable<?> executable) {\r
+ public static AsyncExecutor getAsyncEngine(ConfiguredExecutable<?> executable) {\r
if (isTargetedForLocalExecution(executable)) {\r
return new AsyncLocalRunner();\r
}\r
- return new AsyncJobRunner();\r
+ return new AsyncClusterRunner();\r
}\r
\r
public static AsyncExecutor getAsyncEngine(String taskId) {\r
if (isLocal(taskId)) {\r
return new AsyncLocalRunner();\r
}\r
- return new AsyncJobRunner();\r
+ return new AsyncClusterRunner();\r
}\r
\r
- public static SyncExecutor getSyncEngine(ConfiguredExecutable<?> executable)\r
- throws JobSubmissionException {\r
+ public static SyncExecutor getSyncEngine(ConfiguredExecutable<?> executable) throws JobSubmissionException {\r
if (isTargetedForLocalExecution(executable)) {\r
return new LocalRunner(executable);\r
}\r
- return JobRunner.getInstance(executable);\r
+ return ClusterRunner.getInstance(executable);\r
}\r
\r
- static boolean isTargetedForLocalExecution(\r
- ConfiguredExecutable<?> executable) {\r
+ static boolean isTargetedForLocalExecution(ConfiguredExecutable<?> executable) {\r
// In the uncommon case that the cluster and local execution temporary\r
// directories are the same, in this case the method return true anyway\r
\r