|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectiterator.AbstractIterator
util.CommandLineRunner
public abstract class CommandLineRunner
Utility to assist running a tool from the command line. Firstly,
CommandLine is a superior to Runtime for many reasons
described in its javadoc. This class, in addition, provides for a designated
scratch directory, and the facility to monitor a job once it's launched. This
is often the case with advanced analysis tools, which need to be launched and
then monitored for completion. Simplifies interfacing with a job scheduler
such as PBS.
| Field Summary | |
|---|---|
protected CommandLine |
commandLine
|
protected static int |
DEFAULT_POLL_INTERVAL
qstat poll interval in seconds. |
protected static java.lang.String |
DEFAULT_RUN_COMMAND
Command to run the tool, usually a symlink to a script. |
protected static java.lang.String |
DEFAULT_SCRATCH_DIR
Scratch directory, if required |
protected static java.lang.String |
DEFAULT_STATUS_COMMAND
Status command to check on CART3D. |
protected static double |
DEFAULT_TIMEOUT_INTERVAL
Timeout interval in seconds. |
protected java.lang.String |
statArgument
|
protected double |
timeElapsed
|
| Fields inherited from class iterator.AbstractIterator |
|---|
diagnosticString, iter |
| Constructor Summary | |
|---|---|
CommandLineRunner()
Default constructor. |
|
CommandLineRunner(boolean inline)
|
|
| Method Summary | |
|---|---|
java.lang.String |
getArgList()
Returns the argList. |
int |
getPollInterval()
Returns the pollInterval. |
java.lang.String |
getRunCommand()
Returns the command used to run the tool/analysis. |
java.lang.String |
getScratchDir()
Returns the directory for any file I/O that this task may need. |
java.lang.String |
getStatusCommand()
Returns the command to check for monitoring completion. |
double |
getTimeoutInterval()
Returns the timeout interval. |
void |
init()
Initialization routine |
boolean |
isInline()
Returns the inline. |
boolean |
isTerminated()
Returns true after a timeout. |
void |
iterate()
Iterates until termination. |
void |
run()
Runs the task that this class manages. |
void |
run(java.util.ArrayList<java.lang.String> args)
|
void |
run(java.lang.String arg)
|
void |
setArgList(java.lang.String argList)
Sets the argList. |
void |
setInline(boolean inline)
Sets the inline. |
void |
setPollInterval(int pollInterval)
Sets the interval at which the system is queried for completion of the running task. |
void |
setRunCommand(java.lang.String runCommand)
Sets the run command. |
void |
setScratchDir(java.lang.String scratchDir)
Sets the scratch directory to be used for any file IO that this task generates. |
void |
setStatusCommand(java.lang.String statusCommand)
Sets the command to query completion of this task. |
void |
setTimeoutInterval(double timeoutInterval)
Sets the timeout interval. |
void |
singleIteration()
Sleeps for a designated sleep interval. |
protected void |
updateDiagnostics()
Provides access to the diagnosticString, so that the user has
flexibility over multiple methods accessing this string at different times. |
| Methods inherited from class iterator.AbstractIterator |
|---|
isVerbose, printDiagnostics, setVerbose |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static int DEFAULT_POLL_INTERVAL
qstat poll interval in seconds.
protected static java.lang.String DEFAULT_RUN_COMMAND
protected static java.lang.String DEFAULT_SCRATCH_DIR
protected static java.lang.String DEFAULT_STATUS_COMMAND
protected static double DEFAULT_TIMEOUT_INTERVAL
protected CommandLine commandLine
protected java.lang.String statArgument
protected double timeElapsed
| Constructor Detail |
|---|
public CommandLineRunner()
public CommandLineRunner(boolean inline)
| Method Detail |
|---|
public java.lang.String getArgList()
public int getPollInterval()
public java.lang.String getRunCommand()
public java.lang.String getScratchDir()
public java.lang.String getStatusCommand()
public double getTimeoutInterval()
public void init()
throws Exceptions.ComputationException
Iterable
Exceptions.ComputationExceptionpublic boolean isTerminated()
true after a timeout.
true when done.Iterable.isTerminated()public void iterate()
Iterable
iterate in interface Iterableiterate in class AbstractIteratorpublic void run(java.util.ArrayList<java.lang.String> args)
args - public void run(java.lang.String arg)
arg - public void run()
public void setArgList(java.lang.String argList)
argList - the given argList.public void setPollInterval(int pollInterval)
pollInterval - interval the given poll interval.public void setRunCommand(java.lang.String runCommand)
runCommand - the given run command.public void setScratchDir(java.lang.String scratchDir)
scratchDir - the given scratch directory.public void setStatusCommand(java.lang.String statusCommand)
statusCommand - the given status command.public void setTimeoutInterval(double timeoutInterval)
timeoutInterval - the given interval.public void singleIteration()
Iterable.singleIteration()protected void updateDiagnostics()
AbstractIteratordiagnosticString, so that the user has
flexibility over multiple methods accessing this string at different times.
updateDiagnostics in class AbstractIteratorpublic boolean isInline()
public void setInline(boolean inline)
inline - the given inline.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||