-/*\r
- * Copyright (c) 2010 Peter Troshin JAva Bioinformatics Analysis Web Services\r
- * (JABAWS) @version: 2.0 \r
+/* Copyright (c) 2010 Peter Troshin\r
+ * Copyright (c) 2013 Alexander Sherstnev\r
+ * \r
+ * Java Bioinformatics Analysis Web Services (JABAWS)\r
+ * (JABAWS) @version: 2.5 \r
* \r
* This library is free software; you can redistribute it and/or modify it under \r
* the terms of the Apache License version 2 as published\r
import java.io.IOException;\r
import java.text.ParseException;\r
import java.util.Arrays;\r
-import java.util.HashSet;\r
\r
import javax.xml.bind.ValidationException;\r
\r
import org.testng.annotations.BeforeMethod;\r
import org.testng.annotations.Test;\r
\r
-import compbio.data.sequence.Score;\r
import compbio.data.sequence.ScoreManager;\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
\r
public class AAConTester {\r
\r
- public static final String CURRENT_DIRECTORY = SysPrefs\r
- .getCurrentDirectory() + File.separator;\r
-\r
- public static String test_outfile = "TO1381.aacon.out"; // "/homes/pvtroshin/TO1381.clustal.cluster.out\r
- public static String test_alignment_input = CURRENT_DIRECTORY + "testsrc"\r
- + File.separator + "testdata" + File.separator + "TO1381.fasta.aln";\r
+ public static final String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() + File.separator;\r
+ public static String test_outfile = "TO1381.aacon.out";\r
+ public static String test_alignment_input = CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" + File.separator + "TO1381.fasta.aln";\r
private AACon aacon;\r
\r
@BeforeMethod(alwaysRun = true)\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testRunOnCluster() {\r
- assertFalse(SysPrefs.isWindows,\r
- "Cluster execution can only be in unix environment");\r
+ public void RunOnCluster() {\r
+ assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
try {\r
- ConfiguredExecutable<AACon> confAAcon = Configurator\r
- .configureExecutable(aacon, Executable.ExecProvider.Cluster);\r
+ ConfiguredExecutable<AACon> confAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Cluster);\r
JobRunner runner = JobRunner.getInstance(confAAcon);\r
\r
assertNotNull(runner, "Runner is NULL");\r
runner.executeJob();\r
- // assertNotNull("JobId is null", jobId1);\r
JobStatus status = runner.getJobStatus();\r
- assertTrue(status == JobStatus.PENDING\r
- || status == JobStatus.RUNNING,\r
- "Status of the process is wrong!");\r
+ assertTrue(status == JobStatus.PENDING || status == JobStatus.RUNNING, "Status of the process is wrong!");\r
JobInfo info = runner.getJobInfo();\r
assertNotNull(info, "JobInfo is null");\r
StatisticManager sm = new StatisticManager(info);\r
assertNotNull(sm, "Statictic manager is null");\r
try {\r
-\r
String exits = sm.getExitStatus();\r
assertNotNull("Exit status is null", exits);\r
// cut 4 trailing zeros from the number\r
- int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits)\r
- .intValue();\r
+ int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue();\r
assertEquals(0, exitsInt);\r
System.out.println(sm.getAllStats());\r
\r
e.printStackTrace();\r
fail("Parse Exception: " + e.getMessage());\r
}\r
- // assertFalse(runner.cleanup());\r
assertTrue(sm.hasExited());\r
assertFalse(sm.wasAborted());\r
assertFalse(sm.hasDump());\r
assertFalse(sm.hasSignaled());\r
-\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail("DrmaaException caught:" + e.getMessage());\r
}\r
\r
/**\r
- * This tests fails from time to time depending on the cluster load or some\r
+ * This test fails from time to time depending on the cluster load or some\r
* other factors. Any client code has to adjust for this issue\r
*/\r
@Test(groups = {AllTestSuit.test_group_runner, AllTestSuit.test_group_cluster})\r
- public void testRunOnClusterAsync() {\r
- assertFalse(SysPrefs.isWindows,\r
- "Cluster execution can only be in unix environment");\r
+ public void RunOnClusterAsync() {\r
+ assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
try {\r
- ConfiguredExecutable<AACon> confAAcon = Configurator\r
- .configureExecutable(aacon, Executable.ExecProvider.Cluster);\r
+ ConfiguredExecutable<AACon> confAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Cluster);\r
AsyncExecutor aengine = Configurator.getAsyncEngine(confAAcon);\r
String jobId = aengine.submitJob(confAAcon);\r
assertNotNull(jobId, "Runner is NULL");\r
System.out.println("Job Status: " + status);\r
Thread.sleep(1000);\r
status = aengine.getJobStatus(jobId);\r
- ConfiguredExecutable<AACon> result = (ConfiguredExecutable<AACon>) aengine\r
- .getResults(jobId);\r
+ ConfiguredExecutable<AACon> result = (ConfiguredExecutable<AACon>) aengine.getResults(jobId);\r
assertNotNull(result);\r
System.out.println("RES:" + result);\r
- // Some times the job could be removed from the cluster\r
- // accounting\r
- // before it has been reported to finish. Make sure\r
- // to stop waiting in such case\r
+ // Some times the job could be removed from the cluster accounting \r
+ // before it has been reported to finish. Make sure to stop waiting in such case\r
if (status == JobStatus.UNDEFINED) {\r
break;\r
}\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testRunLocally() {\r
+ public void RunLocally() {\r
try {\r
- ConfiguredExecutable<AACon> confAAcon = Configurator\r
- .configureExecutable(aacon, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<AACon> confAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Local);\r
\r
// For local execution use relative\r
LocalRunner lr = new LocalRunner(confAAcon);\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testRunLocallyWithPreset() {\r
+ public void RunLocallyWithPreset() {\r
try {\r
PresetManager<AACon> aaconPresets = Util.getPresets(AACon.class);\r
assert aaconPresets != null;\r
- ConfiguredExecutable<AACon> confAAcon = Configurator\r
- .configureExecutable(aacon, Executable.ExecProvider.Local);\r
- Preset<AACon> quick = aaconPresets\r
- .getPresetByName("Quick conservation");\r
+ ConfiguredExecutable<AACon> confAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Local);\r
+ Preset<AACon> quick = aaconPresets.getPresetByName("Quick conservation");\r
confAAcon.addParameters(quick.getOptions());\r
// For local execution use relative\r
LocalRunner lr = new LocalRunner(confAAcon);\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testRunLocallyOnTwoCpu() {\r
+ public void RunLocallyOnTwoCpu() {\r
try {\r
aacon = new AACon();\r
aacon.setInput(test_alignment_input).setOutput(test_outfile);\r
\r
aacon.setNCore(2);\r
- ConfiguredExecutable<AACon> confAAcon = Configurator\r
- .configureExecutable(aacon, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<AACon> confAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Local);\r
confAAcon.addParameters(Arrays.asList("-m=KABAT,JORES"));\r
confAAcon.addParameters(Arrays.asList("-m=TAYLOR_GAPS"));\r
// For local execution use relative\r
assertNotNull(annotations);\r
assertEquals(annotations.asSet().size(), 3);\r
assertEquals(al1.getResults(), annotations);\r
-\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
@Test(groups = {AllTestSuit.test_group_runner})\r
public void readStatistics() {\r
try {\r
- ConfiguredExecutable<AACon> confAAcon = Configurator\r
- .configureExecutable(aacon, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<AACon> confAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Local);\r
// For local execution use relative\r
\r
AsyncExecutor sexec = Configurator.getAsyncEngine(confAAcon);\r
String jobId = sexec.submitJob(confAAcon);\r
- FilePuller fw = FilePuller.newFilePuller(\r
- confAAcon.getWorkDirectory() + File.separator\r
- + AACon.getStatFile(),\r
- FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+ String file = confAAcon.getWorkDirectory() + File.separator + AACon.getStatFile();\r
+ FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
int count = 0;\r
long position = 0;\r
fw.waitForFile(2);\r
JobStatus status = sexec.getJobStatus(jobId);\r
do {\r
- ChunkHolder ch = fw.pull(position);\r
- String chunk = ch.getChunk();\r
- position = ch.getNextPosition();\r
- // System.out.println(chunk);\r
+ if (fw.hasMoreData()) {\r
+ ChunkHolder ch = fw.pull(position);\r
+ String chunk = ch.getChunk();\r
+ position = ch.getNextPosition();\r
+ }\r
count++;\r
// Make sure the loop is terminated if the job fails\r
if ((status == JobStatus.UNDEFINED || status == JobStatus.FAILED)) {\r
Thread.sleep(300);\r
status = sexec.getJobStatus(jobId);\r
} while (status != JobStatus.FINISHED || fw.hasMoreData());\r
-\r
assertTrue(count >= 1);\r
ConfiguredExecutable<?> al = sexec.getResults(jobId);\r
assertNotNull(al.getResults());\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testPersistance() {\r
+ public void Persistance() {\r
try {\r
AACon aacon = new AACon();\r
- aacon.setError("errrr.txt").setInput(test_alignment_input)\r
- .setOutput("outtt.txt");\r
+ aacon.setError("errrr.txt");\r
+ aacon.setInput(test_alignment_input);\r
+ aacon.setOutput("outtt.txt");\r
assertEquals(aacon.getInput(), test_alignment_input);\r
assertEquals(aacon.getError(), "errrr.txt");\r
assertEquals(aacon.getOutput(), "outtt.txt");\r
- ConfiguredExecutable<AACon> cAAcon = Configurator\r
- .configureExecutable(aacon, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<AACon> cAAcon = Configurator.configureExecutable(aacon, Executable.ExecProvider.Local);\r
\r
SyncExecutor sexec = Configurator.getSyncEngine(cAAcon);\r
sexec.executeJob();\r
ConfiguredExecutable<?> al = sexec.waitForResult();\r
assertNotNull(al.getResults());\r
+\r
// Save run configuration\r
assertTrue(cAAcon.saveRunConfiguration());\r
\r
RunConfiguration loadedRun = RunConfiguration\r
.load(new FileInputStream(new File(cAAcon\r
.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
- assertEquals(\r
- ((ConfExecutable<AACon>) cAAcon).getRunConfiguration(),\r
- loadedRun);\r
+ assertEquals(((ConfExecutable<AACon>) cAAcon).getRunConfiguration(),loadedRun);\r
+\r
// Load run configuration as ConfExecutable\r
ConfiguredExecutable<AACon> resurrectedCAAcon = (ConfiguredExecutable<AACon>) cAAcon\r
.loadRunConfiguration(new FileInputStream(new File(cAAcon\r
.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
assertNotNull(resurrectedCAAcon);\r
- assertEquals(resurrectedCAAcon.getExecutable().getInput(),\r
- test_alignment_input);\r
- assertEquals(resurrectedCAAcon.getExecutable().getError(),\r
- "errrr.txt");\r
- assertEquals(resurrectedCAAcon.getExecutable().getOutput(),\r
- "outtt.txt");\r
+ assertEquals(resurrectedCAAcon.getExecutable().getInput(), test_alignment_input);\r
+ assertEquals(resurrectedCAAcon.getExecutable().getError(), "errrr.txt");\r
+ assertEquals(resurrectedCAAcon.getExecutable().getOutput(), "outtt.txt");\r
+\r
// See in details whether executables are the same\r
assertEquals(resurrectedCAAcon.getExecutable(), aacon);\r
\r
- ConfiguredExecutable<AACon> resAAcon = Configurator\r
- .configureExecutable(resurrectedCAAcon.getExecutable(),\r
+ ConfiguredExecutable<AACon> resAAcon = Configurator.configureExecutable(resurrectedCAAcon.getExecutable(),\r
Executable.ExecProvider.Local);\r
\r
- sexec = Configurator.getSyncEngine(resAAcon,\r
- Executable.ExecProvider.Local);\r
+ sexec = Configurator.getSyncEngine(resAAcon, Executable.ExecProvider.Local);\r
sexec.executeJob();\r
al = sexec.waitForResult();\r
assertNotNull(al);\r
-\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail(e.getMessage());\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testConfigurationLoading() {\r
+ public void ConfigurationLoading() {\r
try {\r
- RunnerConfig<AACon> aaconConfig = ConfExecutable\r
- .getRunnerOptions(AACon.class);\r
+ RunnerConfig<AACon> aaconConfig = ConfExecutable.getRunnerOptions(AACon.class);\r
assertNotNull(aaconConfig);\r
assertTrue(aaconConfig.getArguments().size() > 0);\r
\r
- PresetManager<AACon> aaconPresets = ConfExecutable\r
- .getRunnerPresets(AACon.class);\r
+ PresetManager<AACon> aaconPresets = ConfExecutable.getRunnerPresets(AACon.class);\r
assertNotNull(aaconPresets);\r
\r
- LimitsManager<AACon> jronnLimits = ConfExecutable\r
- .getRunnerLimits(AACon.class);\r
- assertNotNull(jronnLimits);\r
- assertTrue(jronnLimits.getLimits().size() > 0);\r
- jronnLimits.validate(aaconPresets);\r
-\r
+ LimitsManager<AACon> aaconLimits = ConfExecutable.getRunnerLimits(AACon.class);\r
+ assertNotNull(aaconLimits);\r
+ assertTrue(aaconLimits.getLimits().size() > 0);\r
+ aaconLimits.validate(aaconPresets);\r
} catch (FileNotFoundException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
fail(e.getLocalizedMessage());\r
}\r
}\r
-\r
}\r
/* Copyright (c) 2009 Peter Troshin\r
+ * Copyright (c) 2013 Alexander Sherstnev\r
* \r
- * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * Java Bioinformatics Analysis Web Services (JABAWS) \r
+ * @version: 2.5 \r
* \r
* This library is free software; you can redistribute it and/or modify it under the terms of the\r
* Apache License version 2 as published by the Apache Software Foundation\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
import java.text.ParseException;\r
-import java.util.Map;\r
\r
import javax.xml.bind.ValidationException;\r
\r
import org.testng.annotations.BeforeMethod;\r
import org.testng.annotations.Test;\r
\r
-import compbio.data.sequence.Score;\r
import compbio.data.sequence.ScoreManager;\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
\r
public class JronnTester {\r
\r
- public static String test_outfile = "TO1381.jronn.out"; // "/homes/pvtroshin/TO1381.clustal.cluster.out\r
-\r
+ public static String test_outfile = "TO1381.jronn.out";\r
private Jronn jronn;\r
\r
@BeforeMethod(alwaysRun = true)\r
jronn.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
}\r
\r
- @Test(groups = {AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner})\r
- public void testRunOnCluster() {\r
- assertFalse(SysPrefs.isWindows,\r
- "Cluster execution can only be in unix environment");\r
+ @Test(groups = {AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner})\r
+ public void RunOnCluster() {\r
+ assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
try {\r
- ConfiguredExecutable<Jronn> confJronn = Configurator\r
- .configureExecutable(jronn, Executable.ExecProvider.Cluster);\r
+ ConfiguredExecutable<Jronn> confJronn = Configurator.configureExecutable(jronn, Executable.ExecProvider.Cluster);\r
JobRunner runner = JobRunner.getInstance(confJronn);\r
\r
assertNotNull(runner, "Runner is NULL");\r
runner.executeJob();\r
- // assertNotNull("JobId is null", jobId1);\r
JobStatus status = runner.getJobStatus();\r
- assertTrue(status == JobStatus.PENDING\r
- || status == JobStatus.RUNNING,\r
- "Status of the process is wrong!");\r
+ assertTrue(status == JobStatus.PENDING || status == JobStatus.RUNNING, "Status of the process is wrong!");\r
JobInfo info = runner.getJobInfo();\r
assertNotNull(info, "JobInfo is null");\r
StatisticManager sm = new StatisticManager(info);\r
assertNotNull(sm, "Statictic manager is null");\r
try {\r
-\r
String exits = sm.getExitStatus();\r
assertNotNull("Exit status is null", exits);\r
// cut 4 trailing zeros from the number\r
- int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits)\r
- .intValue();\r
+ int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue();\r
assertEquals(0, exitsInt);\r
- System.out.println(sm.getAllStats());\r
-\r
+ //System.out.println(sm.getAllStats());\r
} catch (ParseException e) {\r
e.printStackTrace();\r
fail("Parse Exception: " + e.getMessage());\r
}\r
- // assertFalse(runner.cleanup());\r
assertTrue(sm.hasExited());\r
assertFalse(sm.wasAborted());\r
assertFalse(sm.hasDump());\r
assertFalse(sm.hasSignaled());\r
-\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail("DrmaaException caught:" + e.getMessage());\r
* This tests fails from time to time depending on the cluster load or some\r
* other factors. Any client code has to adjust for this issue\r
*/\r
- @Test(groups = {AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner})\r
- public void testRunOnClusterAsync() {\r
- assertFalse(SysPrefs.isWindows,\r
- "Cluster execution can only be in unix environment");\r
+ @Test(groups = {AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner})\r
+ public void RunOnClusterAsync() {\r
+ assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
try {\r
- ConfiguredExecutable<Jronn> confJronn = Configurator\r
- .configureExecutable(jronn, Executable.ExecProvider.Cluster);\r
+ ConfiguredExecutable<Jronn> confJronn = Configurator.configureExecutable(jronn, Executable.ExecProvider.Cluster);\r
AsyncExecutor aengine = Configurator.getAsyncEngine(confJronn);\r
String jobId = aengine.submitJob(confJronn);\r
assertNotNull(jobId, "Runner is NULL");\r
System.out.println("Job Status: " + status);\r
Thread.sleep(1000);\r
status = aengine.getJobStatus(jobId);\r
- ConfiguredExecutable<Jronn> result = (ConfiguredExecutable<Jronn>) aengine\r
- .getResults(jobId);\r
+ ConfiguredExecutable<Jronn> result = (ConfiguredExecutable<Jronn>) aengine.getResults(jobId);\r
assertNotNull(result);\r
System.out.println("RES:" + result);\r
- // Some times the job could be removed from the cluster\r
- // accounting\r
- // before it has been reported to finish. Make sure\r
- // to stop waiting in such case\r
+ // Some times the job could be removed from the cluster accounting before \r
+ // it has been reported to finish. Make sure to stop waiting in such case\r
if (status == JobStatus.UNDEFINED) {\r
break;\r
}\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testRunLocally() {\r
+ public void RunLocally() {\r
try {\r
- ConfiguredExecutable<Jronn> confJronn = Configurator\r
- .configureExecutable(jronn, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<Jronn> confJronn = Configurator.configureExecutable(jronn, Executable.ExecProvider.Local);\r
\r
// For local execution use relative\r
LocalRunner lr = new LocalRunner(confJronn);\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testRunLocallyOnTwoCpu() {\r
+ public void RunLocallyOnTwoCpu() {\r
try {\r
jronn.setNCore(2);\r
- ConfiguredExecutable<Jronn> confJronn = Configurator\r
- .configureExecutable(jronn, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<Jronn> confJronn = Configurator.configureExecutable(jronn, Executable.ExecProvider.Local);\r
\r
// For local execution use relative\r
LocalRunner lr = new LocalRunner(confJronn);\r
@Test(groups = {AllTestSuit.test_group_runner})\r
public void readStatistics() {\r
try {\r
- ConfiguredExecutable<Jronn> confJronn = Configurator\r
- .configureExecutable(jronn, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<Jronn> confJronn = Configurator.configureExecutable(jronn, Executable.ExecProvider.Local);\r
// For local execution use relavive\r
\r
AsyncExecutor sexec = Configurator.getAsyncEngine(confJronn);\r
String jobId = sexec.submitJob(confJronn);\r
- FilePuller fw = FilePuller.newFilePuller(\r
- confJronn.getWorkDirectory() + File.separator\r
- + Jronn.getStatFile(),\r
- FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+ String file = confJronn.getWorkDirectory() + File.separator + Jronn.getStatFile();\r
+ FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
int count = 0;\r
long position = 0;\r
fw.waitForFile(4);\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testPersistance() {\r
+ public void Persistance() {\r
try {\r
Jronn jronn = new Jronn();\r
- jronn.setError("errrr.txt").setInput(AllTestSuit.test_input)\r
- .setOutput("outtt.txt");\r
+ jronn.setError("errrr.txt");\r
+ jronn.setInput(AllTestSuit.test_input);\r
+ jronn.setOutput("outtt.txt");\r
assertEquals(jronn.getInput(), AllTestSuit.test_input);\r
assertEquals(jronn.getError(), "errrr.txt");\r
assertEquals(jronn.getOutput(), "outtt.txt");\r
- ConfiguredExecutable<Jronn> cJronn = Configurator\r
- .configureExecutable(jronn, Executable.ExecProvider.Local);\r
-\r
+ ConfiguredExecutable<Jronn> cJronn = Configurator.configureExecutable(jronn, Executable.ExecProvider.Local);\r
SyncExecutor sexec = Configurator.getSyncEngine(cJronn);\r
sexec.executeJob();\r
ConfiguredExecutable<?> al = sexec.waitForResult();\r
loadedRun);\r
// Load run configuration as ConfExecutable\r
ConfiguredExecutable<Jronn> resurrectedCMuscle = (ConfiguredExecutable<Jronn>) cJronn\r
- .loadRunConfiguration(new FileInputStream(new File(cJronn\r
- .getWorkDirectory(), RunConfiguration.rconfigFile)));\r
+ .loadRunConfiguration(new FileInputStream(new File(cJronn.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
assertNotNull(resurrectedCMuscle);\r
assertEquals(resurrectedCMuscle.getExecutable().getInput(),\r
AllTestSuit.test_input);\r
.configureExecutable(resurrectedCMuscle.getExecutable(),\r
Executable.ExecProvider.Local);\r
\r
- sexec = Configurator.getSyncEngine(resJronn,\r
- Executable.ExecProvider.Local);\r
+ sexec = Configurator.getSyncEngine(resJronn, Executable.ExecProvider.Local);\r
sexec.executeJob();\r
al = sexec.waitForResult();\r
assertNotNull(al);\r
-\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail(e.getMessage());\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testConfigurationLoading() {\r
+ public void ConfigurationLoading() {\r
try {\r
- RunnerConfig<Jronn> jronnConfig = ConfExecutable\r
- .getRunnerOptions(Jronn.class);\r
- // There is not supported parameters for Jronn\r
- assertNull(jronnConfig);\r
+ RunnerConfig<Jronn> jronnConfig = ConfExecutable.getRunnerOptions(Jronn.class);\r
+ assertNull(jronnConfig); // There is no supported parameters for Jronn\r
\r
- PresetManager<Jronn> jronnPresets = ConfExecutable\r
- .getRunnerPresets(Jronn.class);\r
+ PresetManager<Jronn> jronnPresets = ConfExecutable.getRunnerPresets(Jronn.class);\r
assertNull(jronnPresets); // there is no presets\r
\r
- LimitsManager<Jronn> jronnLimits = ConfExecutable\r
- .getRunnerLimits(Jronn.class);\r
+ LimitsManager<Jronn> jronnLimits = ConfExecutable.getRunnerLimits(Jronn.class);\r
assertNotNull(jronnLimits);\r
assertTrue(jronnLimits.getLimits().size() > 0);\r
jronnLimits.validate(jronnPresets);\r
fail(e.getLocalizedMessage());\r
}\r
}\r
-\r
}\r
/* Copyright (c) 2009 Peter Troshin\r
+ * Copyright (c) 2013 Alexander Sherstnev\r
* \r
- * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS)\r
+ * @version: 2.5 \r
* \r
* This library is free software; you can redistribute it and/or modify it under the terms of the\r
* Apache License version 2 as published by the Apache Software Foundation\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
import java.text.ParseException;\r
-import java.util.ArrayList;\r
import java.util.Collections;\r
import java.util.List;\r
\r
import javax.xml.bind.JAXBException;\r
-import javax.xml.bind.ValidationException;\r
\r
import org.ggf.drmaa.DrmaaException;\r
import org.ggf.drmaa.JobInfo;\r
import org.testng.annotations.Test;\r
\r
-import compbio.data.sequence.FastaSequence;\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
import compbio.engine.FilePuller;\r
import compbio.engine.SyncExecutor;\r
+import compbio.engine.client.Util;\r
import compbio.engine.client.ConfExecutable;\r
import compbio.engine.client.ConfiguredExecutable;\r
import compbio.engine.client.Executable;\r
import compbio.metadata.JobStatus;\r
import compbio.metadata.JobSubmissionException;\r
import compbio.metadata.LimitsManager;\r
-import compbio.metadata.PresetManager;\r
import compbio.metadata.ResultNotAvailableException;\r
import compbio.metadata.RunnerConfig;\r
import compbio.runner.OptionCombinator;\r
-import compbio.runner.Util;\r
import compbio.util.FileWatcher;\r
import compbio.util.SysPrefs;\r
\r
public class ClustalOTester {\r
\r
- static final String clustalConfigFile = AllTestSuit.TEST_DATA_PATH\r
- + "ClustaloParameters.xml";\r
+ static final String clustalConfigFile = AllTestSuit.TEST_DATA_PATH + "ClustaloParameters.xml";\r
public static String test_outfile = "TO1381.clustalo.out";\r
public static String cluster_test_outfile = "TO1381.clustalo.cluster.out";\r
\r
- @Test(groups = {AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner})\r
- public void testRunOnCluster() {\r
- ClustalO clustal = new ClustalO();\r
- assertFalse(SysPrefs.isWindows,\r
- "Cluster execution can only be in unix environment");\r
- clustal.setInput(AllTestSuit.test_input)\r
- .setOutput(cluster_test_outfile);\r
-\r
- try {\r
-\r
- ConfiguredExecutable<ClustalO> confClustal = Configurator\r
- .configureExecutable(clustal);\r
- JobRunner runner = JobRunner.getInstance(confClustal);\r
- // ClusterSession csession = JobRunner.getSession();\r
- assertNotNull(runner);\r
- runner.executeJob();\r
- // assertNotNull("JobId is null", jobId1);\r
- JobStatus status = runner.getJobStatus();\r
- assertTrue(status == JobStatus.PENDING\r
- || status == JobStatus.RUNNING);\r
- JobInfo info = runner.getJobInfo();\r
- assertNotNull(info);\r
- StatisticManager sm = new StatisticManager(info);\r
- assertNotNull(sm);\r
- try {\r
- String exits = sm.getExitStatus();\r
- assertNotNull("Exit status is null", exits);\r
- // cut 4 trailing zeros from the number\r
- int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits)\r
- .intValue();\r
- assertEquals(0, exitsInt);\r
- System.out.println(sm.getAllStats());\r
-\r
- } catch (ParseException e) {\r
- e.printStackTrace();\r
- fail("Parse Exception: " + e.getMessage());\r
- }\r
- // At present the task directory could not be completely removed\r
- // @see JobRunner.cleanup()\r
- assertFalse(runner.cleanup(),\r
- "Could not remove some files whilst cleaning up ");\r
- assertTrue(sm.hasExited());\r
- assertFalse(sm.wasAborted());\r
- assertFalse(sm.hasDump());\r
- assertFalse(sm.hasSignaled());\r
-\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- } catch (DrmaaException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- }\r
- }\r
-\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testRunLocally() {\r
+ public void RunLocally() {\r
ClustalO clustal = new ClustalO();\r
clustal.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
try {\r
-\r
// For local execution use relavive\r
- ConfiguredExecutable<ClustalO> confClustal = Configurator\r
- .configureExecutable(clustal, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<ClustalO> confClustal = Configurator.configureExecutable(clustal, Executable.ExecProvider.Local);\r
LocalRunner lr = new LocalRunner(confClustal);\r
lr.executeJob();\r
confClustal = (ConfiguredExecutable<ClustalO>) lr.waitForResult();\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testConfigurationLoading() {\r
+ public void ConfigurationLoading() {\r
try {\r
- RunnerConfig<ClustalO> clustalConfig = ConfExecutable\r
- .getRunnerOptions(ClustalO.class);\r
+ RunnerConfig<ClustalO> clustalConfig = ConfExecutable.getRunnerOptions(ClustalO.class);\r
assertNotNull(clustalConfig);\r
assertTrue(clustalConfig.getArguments().size() > 0);\r
\r
- /* Unsupported\r
- PresetManager<ClustalO> clustalPresets = ConfExecutable\r
- .getRunnerPresets(ClustalO.class);\r
- assertNotNull(clustalPresets);\r
- assertTrue(clustalPresets.getPresets().size() > 0);\r
- clustalPresets.validate(clustalConfig);\r
- */\r
- LimitsManager<ClustalO> clustalLimits = ConfExecutable\r
- .getRunnerLimits(ClustalO.class);\r
+ LimitsManager<ClustalO> clustalLimits = ConfExecutable.getRunnerLimits(ClustalO.class);\r
assertNotNull(clustalLimits);\r
assertTrue(clustalLimits.getLimits().size() > 0);\r
- //clustalLimits.validate(clustalPresets);\r
-\r
} catch (FileNotFoundException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testOptionsLocally() {\r
+ public void OptionsLocally() {\r
try {\r
-\r
- RunnerConfigMarshaller<ClustalO> clustalmarsh = new RunnerConfigMarshaller<ClustalO>(\r
- RunnerConfig.class);\r
-\r
- RunnerConfig<ClustalO> clustalConfig = clustalmarsh.read(\r
- new FileInputStream(new File(clustalConfigFile)),\r
- RunnerConfig.class);\r
+ RunnerConfigMarshaller<ClustalO> clustalmarsh = new RunnerConfigMarshaller<ClustalO>(RunnerConfig.class);\r
+ RunnerConfig<ClustalO> clustalConfig = clustalmarsh.read(new FileInputStream(new File(clustalConfigFile)), RunnerConfig.class);\r
\r
OptionCombinator clustalOpc = new OptionCombinator(clustalConfig);\r
List<String> options = clustalOpc.getOptionsAtRandom();\r
for (int i = 0; i < options.size(); i++) {\r
System.out.println("Using options: " + options);\r
ClustalO clustal = new ClustalO();\r
- clustal.setInput(AllTestSuit.test_input)\r
- .setOutput(test_outfile);\r
+ clustal.setInput(AllTestSuit.test_input);\r
+ clustal.setOutput(test_outfile);\r
\r
// For local execution use relavive\r
- ConfiguredExecutable<ClustalO> confClustal = Configurator\r
- .configureExecutable(clustal, ExecProvider.Local);\r
+ ConfiguredExecutable<ClustalO> confClustal = Configurator.configureExecutable(clustal, ExecProvider.Local);\r
\r
// Add options to the executable\r
confClustal.addParameters(options);\r
\r
LocalRunner lr = new LocalRunner(confClustal);\r
lr.executeJob();\r
- confClustal = (ConfiguredExecutable<ClustalO>) lr\r
- .waitForResult();\r
+ confClustal = (ConfiguredExecutable<ClustalO>) lr.waitForResult();\r
assertNotNull(confClustal.getResults());\r
Collections.shuffle(options);\r
}\r
}\r
}\r
\r
- public static final void main(String[] args) throws JobSubmissionException,\r
- JobExecutionException, InterruptedException {\r
+ public static final void main(String[] args)\r
+ throws JobSubmissionException, JobExecutionException, InterruptedException {\r
ClustalO clustal = new ClustalO();\r
clustal.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
// For local execution use relavive\r
- ConfiguredExecutable<ClustalO> confClustal = Configurator\r
- .configureExecutable(clustal);\r
+ ConfiguredExecutable<ClustalO> confClustal = Configurator.configureExecutable(clustal);\r
AsyncExecutor lr = new AsyncLocalRunner();\r
lr.submitJob(confClustal);\r
Thread.sleep(3000);\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void testPersistance() {\r
+ public void Persistance() {\r
try {\r
ClustalO clustal = new ClustalO();\r
- clustal.setError("errrr.txt").setInput(AllTestSuit.test_input)\r
- .setOutput("outtt.txt");\r
+ clustal.setError("errrr.txt");\r
+ clustal.setInput(AllTestSuit.test_input);\r
+ clustal.setOutput("outtt.txt");\r
assertEquals(clustal.getInput(), AllTestSuit.test_input);\r
assertEquals(clustal.getError(), "errrr.txt");\r
assertEquals(clustal.getOutput(), "outtt.txt");\r
- ConfiguredExecutable<ClustalO> cClustal = Configurator\r
- .configureExecutable(clustal, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<ClustalO> cClustal = Configurator.configureExecutable(clustal, Executable.ExecProvider.Local);\r
\r
SyncExecutor sexec = Configurator.getSyncEngine(cClustal);\r
sexec.executeJob();\r
assertTrue(cClustal.saveRunConfiguration());\r
\r
// See if loaded configuration is the same as saved\r
- RunConfiguration loadedRun = RunConfiguration\r
- .load(new FileInputStream(new File(cClustal\r
- .getWorkDirectory(), RunConfiguration.rconfigFile)));\r
+ RunConfiguration loadedRun = RunConfiguration.load(new FileInputStream(new File(cClustal.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
assertTrue(((ConfExecutable<ClustalO>) cClustal)\r
.getRunConfiguration().equals(loadedRun));\r
// Load run configuration as ConfExecutable\r
.configureExecutable(resurrectedCclustal.getExecutable(),\r
Executable.ExecProvider.Local);\r
\r
- sexec = Configurator.getSyncEngine(resclustal,\r
- Executable.ExecProvider.Local);\r
+ sexec = Configurator.getSyncEngine(resclustal, Executable.ExecProvider.Local);\r
sexec.executeJob();\r
cClustal = (ConfiguredExecutable<ClustalO>) sexec.waitForResult();\r
assertNotNull(cClustal.getResults());\r
}\r
\r
@Test(groups = {AllTestSuit.test_group_runner})\r
- public void readStatistics() {\r
+ public void readStatistics()\r
+ throws InterruptedException {\r
try {\r
- ClustalO clustal = new ClustalO().setInput(AllTestSuit.test_input)\r
- .setOutput(test_outfile);\r
- ConfiguredExecutable<ClustalO> confClustal = Configurator\r
- .configureExecutable(clustal, Executable.ExecProvider.Local);\r
-\r
- AsyncExecutor sexec = Configurator.getAsyncEngine(confClustal);\r
- String jobId = sexec.submitJob(confClustal);\r
- FilePuller fw = FilePuller.newFilePuller(\r
- confClustal.getWorkDirectory() + File.separator\r
- + ClustalW.getStatFile(),\r
- FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+ ClustalO al = new ClustalO();\r
+ al.setInput(AllTestSuit.test_input);\r
+ al.setOutput(test_outfile);\r
+ ConfiguredExecutable<ClustalO> confal = Configurator.configureExecutable(al, Executable.ExecProvider.Local);\r
+\r
+ AsyncExecutor sexec = Configurator.getAsyncEngine(confal);\r
+ String jobId = sexec.submitJob(confal);\r
+ String file = Util.getFullPath(confal.getWorkDirectory(), ClustalW.getStatFile());\r
+ FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
int count = 0;\r
long position = 0;\r
fw.waitForFile(4);\r
- while (!(sexec.getJobStatus(jobId) == JobStatus.FINISHED\r
- || sexec.getJobStatus(jobId) == JobStatus.FAILED || sexec\r
- .getJobStatus(jobId) == JobStatus.UNDEFINED)\r
- || fw.hasMoreData()) {\r
- ChunkHolder ch = fw.pull(position);\r
- String chunk = ch.getChunk();\r
- position = ch.getNextPosition();\r
- System.out.print(chunk);\r
+ JobStatus status = sexec.getJobStatus(jobId);\r
+ while (status != JobStatus.FINISHED || fw.hasMoreData()) {\r
+ if (fw.hasMoreData()) {\r
+ ChunkHolder ch = fw.pull(position);\r
+ String chunk = ch.getChunk();\r
+ position = ch.getNextPosition();\r
+ }\r
count++;\r
+ if ((status == JobStatus.UNDEFINED || status == JobStatus.FAILED)) {\r
+ fail("job " + jobId +" failed!");\r
+ break;\r
+ }\r
+ Thread.sleep(200);\r
+ status = sexec.getJobStatus(jobId);\r
+ System.out.println("CLustalO: Job status = " + status + ", file status = " + fw.hasMoreData());\r
}\r
assertTrue(count > 1);\r
- ConfiguredExecutable<?> al = sexec.getResults(jobId);\r
- assertNotNull(al.getResults());\r
+ ConfiguredExecutable<?> al2 = sexec.getResults(jobId);\r
+ assertNotNull(al2.getResults());\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail(e.getMessage());\r
}\r
}\r
\r
- @Test(groups = {AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner})\r
+ @Test(groups = {AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner})\r
+ public void RunOnCluster() {\r
+ ClustalO clustal = new ClustalO();\r
+ assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
+ clustal.setInput(AllTestSuit.test_input).setOutput(cluster_test_outfile);\r
+ try {\r
+ ConfiguredExecutable<ClustalO> confClustal = Configurator.configureExecutable(clustal);\r
+ JobRunner runner = JobRunner.getInstance(confClustal);\r
+ // ClusterSession csession = JobRunner.getSession();\r
+ assertNotNull(runner);\r
+ runner.executeJob();\r
+ // assertNotNull("JobId is null", jobId1);\r
+ JobStatus status = runner.getJobStatus();\r
+ assertTrue(status == JobStatus.PENDING || status == JobStatus.RUNNING);\r
+ JobInfo info = runner.getJobInfo();\r
+ assertNotNull(info);\r
+ StatisticManager sm = new StatisticManager(info);\r
+ assertNotNull(sm);\r
+ try {\r
+ String exits = sm.getExitStatus();\r
+ assertNotNull("Exit status is null", exits);\r
+ // cut 4 trailing zeros from the number\r
+ int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue();\r
+ assertEquals(0, exitsInt);\r
+ System.out.println(sm.getAllStats());\r
+ } catch (ParseException e) {\r
+ e.printStackTrace();\r
+ fail("Parse Exception: " + e.getMessage());\r
+ }\r
+ // At present the task directory could not be completely removed\r
+ // @see JobRunner.cleanup()\r
+ assertFalse(runner.cleanup(), "Could not remove some files whilst cleaning up ");\r
+ assertTrue(sm.hasExited());\r
+ assertFalse(sm.wasAborted());\r
+ assertFalse(sm.hasDump());\r
+ assertFalse(sm.hasSignaled());\r
+ } catch (JobSubmissionException e) {\r
+ e.printStackTrace();\r
+ fail("DrmaaException caught:" + e.getMessage());\r
+ } catch (JobExecutionException e) {\r
+ e.printStackTrace();\r
+ fail("DrmaaException caught:" + e.getMessage());\r
+ } catch (DrmaaException e) {\r
+ e.printStackTrace();\r
+ fail("DrmaaException caught:" + e.getMessage());\r
+ }\r
+ }\r
+\r
+ @Test(groups = {AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner})\r
public void readStatisticsClusterExecution() {\r
try {\r
- ClustalO clustal = new ClustalO().setInput(AllTestSuit.test_input)\r
- .setOutput(test_outfile);\r
- ConfiguredExecutable<ClustalO> confClustal = Configurator\r
- .configureExecutable(clustal,\r
- Executable.ExecProvider.Cluster);\r
+ ClustalO clustal = new ClustalO().setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
+ ConfiguredExecutable<ClustalO> confClustal = Configurator.configureExecutable(clustal, Executable.ExecProvider.Cluster);\r
\r
AsyncExecutor sexec = Configurator.getAsyncEngine(confClustal);\r
String jobId = sexec.submitJob(confClustal);\r
- FilePuller fw = FilePuller.newFilePuller(\r
- confClustal.getWorkDirectory() + File.separator\r
- + ClustalW.getStatFile(),\r
- FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+ String file = Util.getFullPath(confClustal.getWorkDirectory(), ClustalW.getStatFile());\r
+ FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
int count = 0;\r
long position = 0;\r
+ int maxloopcount = 108000; // max waiting time = 6h*60m*60s/0.2(one loop sleep)\r
fw.waitForFile(200);\r
/*\r
* Under certain circumstances DRMAA could report the status wrongly\r
- * thus this loop never ends TODO deal with this!\r
+ * thus this loop never ends. maxloopcount ensures hard stop of the loop...\r
*/\r
- while (!(sexec.getJobStatus(jobId) == JobStatus.FINISHED || sexec\r
- .getJobStatus(jobId) == JobStatus.FAILED)\r
- || fw.hasMoreData()) {\r
+ while (!( sexec.getJobStatus(jobId) == JobStatus.FINISHED || sexec.getJobStatus(jobId) == JobStatus.FAILED) \r
+ || count < maxloopcount || fw.hasMoreData()) {\r
ChunkHolder ch = fw.pull(position);\r
String chunk = ch.getChunk();\r
position = ch.getNextPosition();\r
count++;\r
Thread.sleep(200);\r
if (sexec.getJobStatus(jobId) == JobStatus.UNDEFINED) {\r
- System.out.println("DRMAA reported wrong status for job + "\r
- + jobId + " continue anyway!");\r
+ System.out.println("DRMAA reported wrong status for job + " + jobId + " continue anyway!");\r
break;\r
}\r
}\r
/* Copyright (c) 2009 Peter Troshin\r
+ * Copyright (c) 2013 Alexander Sherstnev\r
* \r
- * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS)\r
+ * @version: 2.5 \r
* \r
* This library is free software; you can redistribute it and/or modify it under the terms of the\r
* Apache License version 2 as published by the Apache Software Foundation\r
\r
public class ClustalWTester {\r
\r
- static final String clustalConfigFile = AllTestSuit.TEST_DATA_PATH\r
- + "ClustalParameters.xml";\r
+ static final String clustalConfigFile = AllTestSuit.TEST_DATA_PATH + "ClustalParameters.xml";\r
public static String test_outfile = "TO1381.clustal.out";\r
public static String cluster_test_outfile = "TO1381.clustal.cluster.out";\r
\r
- @Test(groups = { AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner })\r
- public void testRunOnCluster() {\r
- ClustalW clustal = new ClustalW();\r
- assertFalse(SysPrefs.isWindows,\r
- "Cluster execution can only be in unix environment");\r
- clustal.setInput(AllTestSuit.test_input)\r
- .setOutput(cluster_test_outfile);\r
-\r
- try {\r
-\r
- ConfiguredExecutable<ClustalW> confClustal = Configurator\r
- .configureExecutable(clustal);\r
- JobRunner runner = JobRunner.getInstance(confClustal);\r
- // ClusterSession csession = JobRunner.getSession();\r
- assertNotNull(runner);\r
- runner.executeJob();\r
- // assertNotNull("JobId is null", jobId1);\r
- JobStatus status = runner.getJobStatus();\r
- assertTrue(status == JobStatus.PENDING\r
- || status == JobStatus.RUNNING);\r
- JobInfo info = runner.getJobInfo();\r
- assertNotNull(info);\r
- StatisticManager sm = new StatisticManager(info);\r
- assertNotNull(sm);\r
- try {\r
- String exits = sm.getExitStatus();\r
- assertNotNull("Exit status is null", exits);\r
- // cut 4 trailing zeros from the number\r
- int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits)\r
- .intValue();\r
- assertEquals(0, exitsInt);\r
- System.out.println(sm.getAllStats());\r
-\r
- } catch (ParseException e) {\r
- e.printStackTrace();\r
- fail("Parse Exception: " + e.getMessage());\r
- }\r
- // At present the task directory could not be completely removed\r
- // @see JobRunner.cleanup()\r
- assertFalse(runner.cleanup(),\r
- "Could not remove some files whilst cleaning up ");\r
- assertTrue(sm.hasExited());\r
- assertFalse(sm.wasAborted());\r
- assertFalse(sm.hasDump());\r
- assertFalse(sm.hasSignaled());\r
-\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- } catch (DrmaaException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- }\r
- }\r
-\r
@Test(groups = { AllTestSuit.test_group_runner })\r
- public void testRunLocally() {\r
+ public void RunLocally() {\r
ClustalW clustal = new ClustalW();\r
clustal.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
try {\r
\r
// For local execution use relavive\r
- ConfiguredExecutable<ClustalW> confClustal = Configurator\r
- .configureExecutable(clustal, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<ClustalW> confClustal = Configurator.configureExecutable(clustal, Executable.ExecProvider.Local);\r
LocalRunner lr = new LocalRunner(confClustal);\r
lr.executeJob();\r
confClustal = (ConfiguredExecutable<ClustalW>) lr.waitForResult();\r
}\r
\r
@Test(groups = { AllTestSuit.test_group_runner })\r
- public void testRunWithMatrix() {\r
+ public void RunWithMatrix() {\r
ClustalW clustal = new ClustalW();\r
clustal.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
clustal.setParameter("-matrix=BLOSUM62");\r
}\r
}\r
\r
- @Test(groups = { AllTestSuit.test_group_runner })\r
- public void testConfigurationLoading() {\r
+ @Test(groups = {AllTestSuit.test_group_runner})\r
+ public void ConfigurationLoading() {\r
try {\r
- RunnerConfig<ClustalW> clustalConfig = ConfExecutable\r
- .getRunnerOptions(ClustalW.class);\r
+ RunnerConfig<ClustalW> clustalConfig = ConfExecutable.getRunnerOptions(ClustalW.class);\r
assertNotNull(clustalConfig);\r
assertTrue(clustalConfig.getArguments().size() > 0);\r
\r
- PresetManager<ClustalW> clustalPresets = ConfExecutable\r
- .getRunnerPresets(ClustalW.class);\r
+ PresetManager<ClustalW> clustalPresets = ConfExecutable.getRunnerPresets(ClustalW.class);\r
assertNotNull(clustalPresets);\r
assertTrue(clustalPresets.getPresets().size() > 0);\r
clustalPresets.validate(clustalConfig);\r
\r
- LimitsManager<ClustalW> clustalLimits = ConfExecutable\r
- .getRunnerLimits(ClustalW.class);\r
+ LimitsManager<ClustalW> clustalLimits = ConfExecutable.getRunnerLimits(ClustalW.class);\r
assertNotNull(clustalLimits);\r
assertTrue(clustalLimits.getLimits().size() > 0);\r
clustalLimits.validate(clustalPresets);\r
-\r
} catch (FileNotFoundException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
}\r
\r
@Test(groups = { AllTestSuit.test_group_runner })\r
- public void testOptionsLocally() {\r
+ public void OptionsLocally() {\r
try {\r
-\r
- RunnerConfigMarshaller<ClustalW> clustalmarsh = new RunnerConfigMarshaller<ClustalW>(\r
- RunnerConfig.class);\r
-\r
- RunnerConfig<ClustalW> clustalConfig = clustalmarsh.read(\r
- new FileInputStream(new File(clustalConfigFile)),\r
- RunnerConfig.class);\r
+ RunnerConfigMarshaller<ClustalW> clustalmarsh = new RunnerConfigMarshaller<ClustalW>(RunnerConfig.class);\r
+ RunnerConfig<ClustalW> clustalConfig = clustalmarsh.read(new FileInputStream(new File(clustalConfigFile)),RunnerConfig.class);\r
\r
OptionCombinator clustalOpc = new OptionCombinator(clustalConfig);\r
List<String> options = clustalOpc.getOptionsAtRandom();\r
for (int i = 0; i < options.size(); i++) {\r
System.out.println("Using options: " + options);\r
ClustalW clustal = new ClustalW();\r
- clustal.setInput(AllTestSuit.test_input)\r
- .setOutput(test_outfile);\r
+ clustal.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
\r
// For local execution use relavive\r
- ConfiguredExecutable<ClustalW> confClustal = Configurator\r
- .configureExecutable(clustal, ExecProvider.Local);\r
+ ConfiguredExecutable<ClustalW> confClustal = Configurator.configureExecutable(clustal, ExecProvider.Local);\r
\r
// Add options to the executable\r
confClustal.addParameters(options);\r
\r
LocalRunner lr = new LocalRunner(confClustal);\r
lr.executeJob();\r
- confClustal = (ConfiguredExecutable<ClustalW>) lr\r
- .waitForResult();\r
+ confClustal = (ConfiguredExecutable<ClustalW>) lr.waitForResult();\r
assertNotNull(confClustal.getResults());\r
Collections.shuffle(options);\r
}\r
-\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
}\r
}\r
\r
- public static final void main(String[] args) throws JobSubmissionException,\r
- JobExecutionException, InterruptedException {\r
+ public static final void main(String[] args)\r
+ throws JobSubmissionException, JobExecutionException, InterruptedException {\r
ClustalW clustal = new ClustalW();\r
clustal.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
// For local execution use relavive\r
- ConfiguredExecutable<ClustalW> confClustal = Configurator\r
- .configureExecutable(clustal);\r
+ ConfiguredExecutable<ClustalW> confClustal = Configurator.configureExecutable(clustal);\r
AsyncExecutor lr = new AsyncLocalRunner();\r
lr.submitJob(confClustal);\r
Thread.sleep(3000);\r
LocalExecutorService.shutDown();\r
}\r
\r
+ // disabled\r
@Test(enabled = false)\r
- public void testAddParameters() {\r
+ public void AddParameters() {\r
ArrayList<FastaSequence> seqs = new ArrayList<FastaSequence>();\r
- FastaSequence fs = new FastaSequence("tests1",\r
- "aqtctcatcatctcatctgcccccgggttatgagtagtacgcatctacg");\r
- FastaSequence fs2 = new FastaSequence("tests2",\r
- "aqtctcatcatctcatctgcccccgggttatgagtagtacgcatctacg");\r
- FastaSequence fs3 = new FastaSequence("tests3",\r
- "aqtctcatcatctcatctgcccccgggttatgagtagtacgcatctacg");\r
+ FastaSequence fs = new FastaSequence("tests1", "aqtctcatcatctcatctgcccccgggttatgagtagtacgcatctacg");\r
+ FastaSequence fs2 = new FastaSequence("tests2", "aqtctcatcatctcatctgcccccgggttatgagtagtacgcatctacg");\r
+ FastaSequence fs3 = new FastaSequence("tests3", "aqtctcatcatctcatctgcccccgggttatgagtagtacgcatctacg");\r
seqs.add(fs);\r
seqs.add(fs2);\r
seqs.add(fs3);\r
}\r
\r
@Test(groups = { AllTestSuit.test_group_runner })\r
- public void testPersistance() {\r
+ public void Persistance() {\r
try {\r
ClustalW clustal = new ClustalW();\r
- clustal.setError("errrr.txt").setInput(AllTestSuit.test_input)\r
- .setOutput("outtt.txt");\r
+ clustal.setError("errrr.txt");\r
+ clustal.setInput(AllTestSuit.test_input);\r
+ clustal.setOutput("outtt.txt");\r
assertEquals(clustal.getInput(), AllTestSuit.test_input);\r
assertEquals(clustal.getError(), "errrr.txt");\r
assertEquals(clustal.getOutput(), "outtt.txt");\r
- ConfiguredExecutable<ClustalW> cClustal = Configurator\r
- .configureExecutable(clustal, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<ClustalW> cClustal = Configurator.configureExecutable(clustal, Executable.ExecProvider.Local);\r
\r
SyncExecutor sexec = Configurator.getSyncEngine(cClustal);\r
sexec.executeJob();\r
.configureExecutable(resurrectedCclustal.getExecutable(),\r
Executable.ExecProvider.Local);\r
\r
- sexec = Configurator.getSyncEngine(resclustal,\r
- Executable.ExecProvider.Local);\r
+ sexec = Configurator.getSyncEngine(resclustal, Executable.ExecProvider.Local);\r
sexec.executeJob();\r
cClustal = (ConfiguredExecutable<ClustalW>) sexec.waitForResult();\r
assertNotNull(cClustal.getResults());\r
-\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail(e.getMessage());\r
@Test(groups = { AllTestSuit.test_group_runner })\r
public void readStatistics() {\r
try {\r
- ClustalW clustal = new ClustalW().setInput(AllTestSuit.test_input)\r
- .setOutput(test_outfile);\r
- ConfiguredExecutable<ClustalW> confClustal = Configurator\r
- .configureExecutable(clustal, Executable.ExecProvider.Local);\r
+ ClustalW clustal = new ClustalW().setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
+ ConfiguredExecutable<ClustalW> confClustal = Configurator.configureExecutable(clustal, Executable.ExecProvider.Local);\r
\r
AsyncExecutor sexec = Configurator.getAsyncEngine(confClustal);\r
String jobId = sexec.submitJob(confClustal);\r
- FilePuller fw = FilePuller.newFilePuller(confClustal\r
- .getWorkDirectory()\r
- + File.separator + ClustalW.getStatFile(),\r
- FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+ String file = confClustal.getWorkDirectory() + File.separator + ClustalW.getStatFile();\r
+ FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
int count = 0;\r
long position = 0;\r
fw.waitForFile(4);\r
}\r
}\r
\r
- @Test(groups = { AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner })\r
+ @Test(groups = { AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner })\r
+ public void RunOnCluster() {\r
+ ClustalW clustal = new ClustalW();\r
+ assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
+ clustal.setInput(AllTestSuit.test_input).setOutput(cluster_test_outfile);\r
+\r
+ try {\r
+ ConfiguredExecutable<ClustalW> confClustal = Configurator.configureExecutable(clustal);\r
+ JobRunner runner = JobRunner.getInstance(confClustal);\r
+ // ClusterSession csession = JobRunner.getSession();\r
+ assertNotNull(runner);\r
+ runner.executeJob();\r
+ // assertNotNull("JobId is null", jobId1);\r
+ JobStatus status = runner.getJobStatus();\r
+ assertTrue(status == JobStatus.PENDING || status == JobStatus.RUNNING);\r
+ JobInfo info = runner.getJobInfo();\r
+ assertNotNull(info);\r
+ StatisticManager sm = new StatisticManager(info);\r
+ assertNotNull(sm);\r
+ try {\r
+ String exits = sm.getExitStatus();\r
+ assertNotNull("Exit status is null", exits);\r
+ // cut 4 trailing zeros from the number\r
+ int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue();\r
+ assertEquals(0, exitsInt);\r
+ System.out.println(sm.getAllStats());\r
+ } catch (ParseException e) {\r
+ e.printStackTrace();\r
+ fail("Parse Exception: " + e.getMessage());\r
+ }\r
+ // At present the task directory could not be completely removed\r
+ // @see JobRunner.cleanup()\r
+ assertFalse(runner.cleanup(), "Could not remove some files whilst cleaning up ");\r
+ assertTrue(sm.hasExited());\r
+ assertFalse(sm.wasAborted());\r
+ assertFalse(sm.hasDump());\r
+ assertFalse(sm.hasSignaled());\r
+ } catch (JobSubmissionException e) {\r
+ e.printStackTrace();\r
+ fail("DrmaaException caught:" + e.getMessage());\r
+ } catch (JobExecutionException e) {\r
+ e.printStackTrace();\r
+ fail("DrmaaException caught:" + e.getMessage());\r
+ } catch (DrmaaException e) {\r
+ e.printStackTrace();\r
+ fail("DrmaaException caught:" + e.getMessage());\r
+ }\r
+ }\r
+\r
+ @Test(groups = { AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner })\r
public void readStatisticsClusterExecution() {\r
try {\r
- ClustalW clustal = new ClustalW().setInput(AllTestSuit.test_input)\r
- .setOutput(test_outfile);\r
- ConfiguredExecutable<ClustalW> confClustal = Configurator\r
- .configureExecutable(clustal,\r
- Executable.ExecProvider.Cluster);\r
+ ClustalW clustal = new ClustalW();\r
+ clustal.setInput(AllTestSuit.test_input);\r
+ clustal.setOutput(test_outfile);\r
+ ConfiguredExecutable<ClustalW> confClustal = Configurator.configureExecutable(clustal, Executable.ExecProvider.Cluster);\r
\r
AsyncExecutor sexec = Configurator.getAsyncEngine(confClustal);\r
String jobId = sexec.submitJob(confClustal);\r
- FilePuller fw = FilePuller.newFilePuller(confClustal\r
- .getWorkDirectory()\r
- + File.separator + ClustalW.getStatFile(),\r
- FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+ String file = confClustal.getWorkDirectory() + File.separator + ClustalW.getStatFile();\r
+ FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
int count = 0;\r
long position = 0;\r
fw.waitForFile(200);\r
/* Copyright (c) 2009 Peter Troshin\r
+ * Copyright (c) 2013 Alexander Sherstnev\r
* \r
- * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * Java Bioinformatics Analysis Web Services (JABAWS)\r
+ * @version: 2.5 \r
* \r
* This library is free software; you can redistribute it and/or modify it under the terms of the\r
* Apache License version 2 as published by the Apache Software Foundation\r
import java.io.FileInputStream;\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
+import java.util.Arrays;\r
\r
import javax.xml.bind.ValidationException;\r
\r
import compbio.engine.client.Executable;\r
import compbio.engine.client.RunConfiguration;\r
import compbio.engine.cluster.drmaa.JobRunner;\r
+import compbio.engine.local.LocalRunner;\r
import compbio.metadata.AllTestSuit;\r
import compbio.metadata.ChunkHolder;\r
import compbio.metadata.JobExecutionException;\r
import compbio.metadata.ResultNotAvailableException;\r
import compbio.metadata.RunnerConfig;\r
import compbio.runner.msa.Tcoffee;\r
+import compbio.runner.predictors.Jpred;\r
import compbio.util.FileWatcher;\r
+import compbio.util.SysPrefs;\r
\r
public class TcoffeeTester {\r
\r
private Tcoffee tcoffee;\r
+ public static final String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() + File.separator;\r
+ public static String test_output = "tcoffee.out";\r
+ public static String test_input = CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" + File.separator + "TO1381.fasta";\r
\r
- @BeforeMethod(groups = { AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows })\r
+ @BeforeMethod(groups = {AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows})\r
public void init() {\r
tcoffee = new Tcoffee();\r
- tcoffee.setInput(AllTestSuit.test_input).setOutput("tcoffee.out")\r
- .setError("tcoffee.progress");\r
+ tcoffee.setInput(test_input);\r
+ tcoffee.setOutput(test_output);\r
+ tcoffee.setError("tcoffee.progress");\r
+ //System.out.println("Tcoffee has been configured!");\r
}\r
\r
- @Test(groups = { AllTestSuit.test_group_runner,\r
- AllTestSuit.test_group_non_windows })\r
- public void testExecute() {\r
+ @Test(groups = { AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows })\r
+ public void RunLocally() {\r
try {\r
- ConfiguredExecutable<Tcoffee> ctcoffee = Configurator\r
- .configureExecutable(tcoffee, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<Tcoffee> ctcoffee = Configurator.configureExecutable(tcoffee, Executable.ExecProvider.Local);\r
// matrix does not appear to work\r
// ctcoffee.getParameters().setParam("-matrix","BLOSUM62");\r
+\r
SyncExecutor sexecutor = Configurator.getSyncEngine(ctcoffee);\r
sexecutor.executeJob();\r
ConfiguredExecutable<?> al = sexecutor.waitForResult();\r
Alignment align = al.getResults();\r
assertNotNull(align);\r
\r
- // System.out.println("Tcoffee stat file: " + tcoffee.getError());\r
+// LocalRunner sexecutor = new LocalRunner(ctcoffee);\r
+// sexecutor.executeJob();\r
+// ConfiguredExecutable<?> al = sexecutor.waitForResult();\r
+// Alignment align = al.getResults();\r
+// assertNotNull(align);\r
+\r
} catch (JobSubmissionException e) {\r
e.printStackTrace();\r
fail(e.getMessage());\r
}\r
}\r
\r
- @Test(groups = { AllTestSuit.test_group_runner,\r
- AllTestSuit.test_group_non_windows })\r
+ @Test(groups = {AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows})\r
public void readStatistics() {\r
try {\r
Tcoffee tcoffee = new Tcoffee().setInput(AllTestSuit.test_input);\r
- ConfiguredExecutable<Tcoffee> confTcoffee = Configurator\r
- .configureExecutable(tcoffee, Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<Tcoffee> confTcoffee = Configurator.configureExecutable(tcoffee, Executable.ExecProvider.Local);\r
\r
AsyncExecutor sexec = Configurator.getAsyncEngine(confTcoffee);\r
String jobId = sexec.submitJob(confTcoffee);\r
- FilePuller fw = FilePuller.newFilePuller(confTcoffee\r
- .getWorkDirectory()\r
- + File.separator + tcoffee.getError(),\r
- FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+ String file = confTcoffee.getWorkDirectory() + File.separator + tcoffee.getError();\r
+ FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
int count = 0;\r
long position = 0;\r
fw.waitForFile(4);\r
- while (!(sexec.getJobStatus(jobId) == JobStatus.FINISHED || sexec\r
- .getJobStatus(jobId) == JobStatus.FAILED || sexec\r
- .getJobStatus(jobId) == JobStatus.UNDEFINED)\r
- || fw.hasMoreData()) {\r
- ChunkHolder ch = fw.pull(position);\r
- String chunk = ch.getChunk();\r
- position = ch.getNextPosition();\r
- System.out.print(chunk);\r
+ while (!(sexec.getJobStatus(jobId) == JobStatus.FINISHED || \r
+ sexec.getJobStatus(jobId) == JobStatus.FAILED || \r
+ sexec.getJobStatus(jobId) == JobStatus.UNDEFINED) || fw.hasMoreData()) {\r
+ if (fw.hasMoreData()) {\r
+ ChunkHolder ch = fw.pull(position);\r
+ String chunk = ch.getChunk();\r
+ position = ch.getNextPosition();\r
+ System.out.print(chunk);\r
+ }\r
count++;\r
}\r
assertTrue(count > 1);\r
}\r
}\r
\r
- @Test(groups = { AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows })\r
- public void testClusterExecute() {\r
- try {\r
- ConfiguredExecutable<Tcoffee> cmafft = Configurator\r
- .configureExecutable(tcoffee,\r
- Executable.ExecProvider.Cluster);\r
- JobRunner sexecutor = (JobRunner) Configurator.getSyncEngine(\r
- cmafft, Executable.ExecProvider.Cluster);\r
- sexecutor.executeJob();\r
- ConfiguredExecutable<?> al = sexecutor.waitForResult();\r
- Alignment align = al.getResults();\r
- assertNotNull(align);\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (ResultNotAvailableException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- }\r
- }\r
-\r
- @Test(groups = { AllTestSuit.test_group_runner,\r
- AllTestSuit.test_group_non_windows })\r
- public void testNcore() {\r
+ @Test(groups = { AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows })\r
+ public void SetNcore() {\r
Tcoffee tc = new Tcoffee();\r
- // System.out.println("TCPRM:" + tc.getParameters(null));\r
assertEquals(tc.getParameters(null).size(), 3);\r
tc.setNCore(2);\r
assertEquals(2, tc.getNCore());\r
assertEquals(tc.getParameters(null).size(), 3);\r
}\r
\r
- @Test(groups = { AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows })\r
- public void testPersistance() {\r
+ @Test(groups = { AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows })\r
+ public void Persistance() {\r
try {\r
Tcoffee tcoffee = new Tcoffee();\r
- tcoffee.setError("errrr.txt").setInput(AllTestSuit.test_input)\r
- .setOutput("outtt.txt");\r
+ tcoffee.setError("errrr.txt");\r
+ tcoffee.setInput(AllTestSuit.test_input);\r
+ tcoffee.setOutput("outtt.txt");\r
assertEquals(tcoffee.getInput(), AllTestSuit.test_input);\r
assertEquals(tcoffee.getError(), "errrr.txt");\r
assertEquals(tcoffee.getOutput(), "outtt.txt");\r
- ConfiguredExecutable<Tcoffee> ctcofee = Configurator\r
- .configureExecutable(tcoffee, Executable.ExecProvider.Local);\r
\r
+ ConfiguredExecutable<Tcoffee> ctcofee = Configurator.configureExecutable(tcoffee, Executable.ExecProvider.Local);\r
SyncExecutor sexec = Configurator.getSyncEngine(ctcofee);\r
sexec.executeJob();\r
ConfiguredExecutable<?> al = sexec.waitForResult();\r
assertTrue(ctcofee.saveRunConfiguration());\r
\r
// See if loaded configuration is the same as saved\r
- RunConfiguration loadedRun = RunConfiguration\r
- .load(new FileInputStream(new File(ctcofee\r
- .getWorkDirectory(), RunConfiguration.rconfigFile)));\r
- assertEquals(((ConfExecutable<Tcoffee>) ctcofee)\r
- .getRunConfiguration(), loadedRun);\r
+ RunConfiguration loadedRun = RunConfiguration.load(new FileInputStream(new File(ctcofee.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
+ assertEquals(((ConfExecutable<Tcoffee>) ctcofee).getRunConfiguration(), loadedRun);\r
+\r
// Load run configuration as ConfExecutable\r
ConfiguredExecutable<Tcoffee> resurrectedCTcoffee = (ConfiguredExecutable<Tcoffee>) ctcofee\r
- .loadRunConfiguration(new FileInputStream(new File(ctcofee\r
- .getWorkDirectory(), RunConfiguration.rconfigFile)));\r
+ .loadRunConfiguration(new FileInputStream(new File(ctcofee.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
assertNotNull(resurrectedCTcoffee);\r
+\r
// See in details whether executables are the same\r
assertEquals(resurrectedCTcoffee.getExecutable(), tcoffee);\r
\r
// Finally rerun the job in the new task directory\r
- ConfiguredExecutable<Tcoffee> restcoffee = Configurator\r
- .configureExecutable(resurrectedCTcoffee.getExecutable(),\r
- Executable.ExecProvider.Local);\r
+ ConfiguredExecutable<Tcoffee> restcoffee = Configurator.configureExecutable(resurrectedCTcoffee.getExecutable(), Executable.ExecProvider.Local);\r
\r
- sexec = Configurator.getSyncEngine(restcoffee,\r
- Executable.ExecProvider.Local);\r
+ sexec = Configurator.getSyncEngine(restcoffee,Executable.ExecProvider.Local);\r
sexec.executeJob();\r
al = sexec.waitForResult();\r
assertNotNull(al);\r
}\r
\r
@Test(groups = { AllTestSuit.test_group_runner })\r
- public void testConfigurationLoading() {\r
+ public void ConfigurationLoading() {\r
try {\r
- RunnerConfig<Tcoffee> tcoffeeConfig = ConfExecutable\r
- .getRunnerOptions(Tcoffee.class);\r
+ RunnerConfig<Tcoffee> tcoffeeConfig = ConfExecutable.getRunnerOptions(Tcoffee.class);\r
assertNotNull(tcoffeeConfig);\r
assertTrue(tcoffeeConfig.getArguments().size() > 0);\r
\r
- PresetManager<Tcoffee> tcoffeePresets = ConfExecutable\r
- .getRunnerPresets(Tcoffee.class);\r
+ PresetManager<Tcoffee> tcoffeePresets = ConfExecutable.getRunnerPresets(Tcoffee.class);\r
assertNotNull(tcoffeePresets);\r
assertTrue(tcoffeePresets.getPresets().size() > 0);\r
tcoffeePresets.validate(tcoffeeConfig);\r
\r
- LimitsManager<Tcoffee> tcoffeeLimits = ConfExecutable\r
- .getRunnerLimits(Tcoffee.class);\r
+ LimitsManager<Tcoffee> tcoffeeLimits = ConfExecutable.getRunnerLimits(Tcoffee.class);\r
assertNotNull(tcoffeeLimits);\r
assertTrue(tcoffeeLimits.getLimits().size() > 0);\r
tcoffeeLimits.validate(tcoffeePresets);\r
e.printStackTrace();\r
fail(e.getLocalizedMessage());\r
}\r
+ }\r
\r
+ // disabled\r
+ @Test(enabled=false,groups = { AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner, AllTestSuit.test_group_non_windows })\r
+ public void RunOnCluster() {\r
+ try {\r
+ ConfiguredExecutable<Tcoffee> cmafft = Configurator.configureExecutable(tcoffee, Executable.ExecProvider.Cluster);\r
+ JobRunner sexecutor = (JobRunner) Configurator.getSyncEngine(cmafft, Executable.ExecProvider.Cluster);\r
+ sexecutor.executeJob();\r
+ ConfiguredExecutable<?> al = sexecutor.waitForResult();\r
+ Alignment align = al.getResults();\r
+ assertNotNull(align);\r
+ } catch (JobSubmissionException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (JobExecutionException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (ResultNotAvailableException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ }\r
}\r
}\r