|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.jhu.ece.iacl.jist.pipeline.ExecutionContext
public class ExecutionContext
An Execution Context provides threaded execution of a processing algorithm with a specified set of input parameters.
Nested Class Summary | |
---|---|
static interface |
ExecutionContext.ContextListener
Listener to monitor for updates to an execution context. |
protected class |
ExecutionContext.ProcessStatusParser
The Class ProcessStatusParser. |
static class |
ExecutionContext.Status
The Enum Status. |
static class |
ExecutionContext.Update
The Enum Update. |
Field Summary | |
---|---|
protected long |
actualTime
Elapsed actual time in milliseconds. |
protected PipeAlgorithm |
algo
Algorithm associated with this context. |
protected java.io.File |
algoRoot
Root directory for algorithm. |
protected int |
allocatedMemory
Allocated memory in MB. |
protected javax.swing.tree.DefaultMutableTreeNode |
ancestorTop
Root node for ancestors. |
protected javax.swing.JTree |
ancestorTree
Tree representing context ancestors. |
protected ParamCollection |
cachedInputParams
Cached parameters to compare against when checking for changes. |
protected java.util.Vector<ExecutionContext> |
callers
Execution contexts that forward to this context. |
static java.lang.String |
classpath
Java class path. |
protected java.lang.String |
contextId
Identifying experiment number. |
protected java.lang.String |
contextName
The context name. |
protected long |
cpuTime
Elapsed cpu time in milliseconds. |
protected java.util.Vector<ExecutionContext> |
dependents
Execution contexts that are dependent on the output from this context. |
protected javax.swing.tree.DefaultMutableTreeNode |
descendantTop
Root node for descendants. |
protected javax.swing.JTree |
descendantTree
Tree representing context descendants. |
protected java.io.File |
inputFile
The input file. |
protected ParamCollection |
inputParams
The input parameters. |
protected PipeLayout |
layout
Layout process associated with this context. |
protected boolean |
outOfSync
Out of sync flag. |
protected ParamCollection |
outputParams
The output parameters. |
protected int |
priority
The execution priority. |
protected java.lang.Process |
proc
Running process. |
protected java.lang.Process |
process
Running process. |
protected boolean |
runningFlag
Flag indicating the thread is running. |
protected int |
scenarioId
Identifying scenario number. |
protected java.io.File |
scenarioRoot
Root directory for scenario. |
protected javax.swing.JProgressBar |
statusBar
progress bar to monitor execution status. |
protected java.lang.Thread |
th
Running thread. |
protected static java.lang.Object |
treeGraphLock
The Constant treeGraphLock. |
protected int |
usedMemory
Used memory in MB. |
Constructor Summary | |
---|---|
ExecutionContext(int scenario,
java.lang.String context,
PipeLayout layout,
PipeAlgorithm algo)
Construct a new execution context. |
Method Summary | |
---|---|
void |
addChild(ExecutionContext mod)
Add child execution context that pulls data from this context. |
void |
addContextListener(ExecutionContext.ContextListener listener)
Add context listener. |
void |
addParent(ExecutionContext mod)
Add parent execution context that pushes data to this context. |
protected boolean |
checkInSync()
Check if two input files are in sync. |
void |
clean()
Remove the output directory and anything in it. |
int |
compareTo(ExecutionContext context)
Compare execution contexts by status for sorting purposes. |
void |
createTreeNodes(javax.swing.event.TreeSelectionListener listener)
Create ancestor and descendant tree and set the listener for those trees. |
static boolean |
deleteDir(java.io.File dir,
javax.swing.ProgressMonitor monitor)
Delete all contents in a directory. |
void |
demote()
Decrease context queue priority. |
boolean |
equals(java.lang.Object obj)
Check if contexts are equal by comparing context names. |
long |
getActualTime()
Gets the actual time. |
PipeAlgorithm |
getAlgorithm()
Get algorithm. |
int |
getAllocatedMemory()
Get amount of allocated memory. |
javax.swing.JTree |
getAncestorTree()
Get ancestor tree. |
java.util.Vector<ExecutionContext> |
getCallers()
Get contexts that call this context. |
java.lang.String |
getContextId()
Get context id. |
ParamCollection |
getContextInputParams()
Get context input parameters. |
java.lang.String |
getContextName()
Get context name. |
java.lang.String |
getContextShortName()
Get context name. |
long |
getCpuTime()
Gets the cpu time. |
java.util.Vector<ExecutionContext> |
getDependents()
Get contexts that depend on this context. |
javax.swing.JTree |
getDescendantTree()
Get descendant tree. |
java.lang.String |
getElapsedTimeDescription()
Get elapsed cpu time in milliseconds. |
java.lang.String |
getHashKey()
Gets the hash key. |
static java.lang.String |
getHashKey(java.lang.String label,
java.lang.Class c,
ParamCollection currentParams)
Gets the hash key. |
protected javax.swing.tree.TreePath |
getInitPath(javax.swing.tree.TreeNode node)
Get initial tree path by finding first child element. |
java.io.File |
getInputLocation()
Get directory where input parameters are located. |
ParamCollection |
getInputParamsFromFile()
Load parameters from file. |
PipeLayout |
getLayout()
Get layout owner. |
java.io.File |
getOutputLocation()
Get directory where output will be placed. |
ParamCollection |
getOutputParamsFromFile()
Load output parameters from file. |
int |
getPriority()
Get priority. |
java.lang.Process |
getProcess()
Get running process. |
int |
getScenarioId()
Get scenario id. |
ExecutionContext.Status |
getStatus()
Get execution status. |
javax.swing.JProgressBar |
getStatusBar()
Get progress bar. |
int |
getUsedMemory()
Get used memory. |
protected boolean |
isCompleted()
Check if algorithm has completed by checking if the output file exists. |
boolean |
isOutOfSync()
Return true if file is out of sync. |
protected boolean |
isReady()
Check if algorithm is ready to run by validating the input parameters for this context that are read from an input file. |
protected boolean |
loadContextInputParams()
Copy parameters for this context into pipe graph. |
protected boolean |
loadContextOutputParams()
Copy output parameters from this context into pipe graph. |
protected boolean |
loadLayoutInputParams()
Copy parameters from the pipe graph into this context. |
void |
notifyListeners(ExecutionContext.Update type)
Notify listeners of change. |
void |
promote()
Increase context queue priority. |
boolean |
push()
Push output parameters to input parameters. |
void |
removeAllContextListeners()
Remove all context listeners. |
void |
removeListener(ExecutionContext.ContextListener listener)
Remove context listener. |
void |
reset()
Reset status for context. |
void |
resetStatus()
Reset status for this contexts and its dependents. |
void |
restart()
Restart algorithm by stopping, cleaning, and then starting the algorithm. |
void |
run()
Thread method for running the algorithm. |
protected java.io.File |
saveInputContext()
Save input parameters to file. |
void |
setActualTime(long actualTime)
Set elapsed actual time in milliseconds. |
void |
setAlgorithm(PipeAlgorithm module)
Set algorithm. |
void |
setAllocatedMemory(int totalMemory)
Set amount of allocated memory. |
void |
setContextId(java.lang.String contextId)
Set context id. |
void |
setCpuTime(long cpuTime)
Set elapsed cpu time in milliseconds. |
void |
setLayout(PipeLayout layout)
Set layout owner. |
void |
setPriority(int priority)
Set execution priority. |
void |
setProcess(java.lang.Process proc)
Set running process. |
void |
setScenarioId(int scenarioId)
Set scenario id. |
void |
setStatus(ExecutionContext.Status status)
Set status for context. |
void |
setUsedMemory(int usedMemory)
Set used memory. |
void |
start()
Start running the algorithm. |
void |
stop()
Force algorithm to stop running. |
protected boolean |
synchronizedPush()
Push data from output parameters into child contexts. |
java.lang.String |
toString()
Get context name and algorithm label. |
protected void |
updateAllTreeNodes()
Update all tree nodes for all callers and dependents. |
ExecutionContext.Status |
updateStatus()
Update the status of this context by checking if algorithm is ready and completed. |
protected void |
updateTreeNodes()
Update tree nodes if ancestors or descendants change. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String classpath
protected javax.swing.JProgressBar statusBar
protected long cpuTime
protected long actualTime
protected int usedMemory
protected int allocatedMemory
protected java.lang.Process proc
protected PipeLayout layout
protected PipeAlgorithm algo
protected java.lang.String contextName
protected java.io.File inputFile
protected ParamCollection inputParams
protected ParamCollection cachedInputParams
protected ParamCollection outputParams
protected java.util.Vector<ExecutionContext> callers
protected java.util.Vector<ExecutionContext> dependents
protected int scenarioId
protected java.lang.String contextId
protected java.lang.Process process
protected java.io.File scenarioRoot
protected java.io.File algoRoot
protected boolean runningFlag
protected java.lang.Thread th
protected static final java.lang.Object treeGraphLock
protected javax.swing.JTree ancestorTree
protected javax.swing.JTree descendantTree
protected javax.swing.tree.DefaultMutableTreeNode ancestorTop
protected javax.swing.tree.DefaultMutableTreeNode descendantTop
protected int priority
protected boolean outOfSync
Constructor Detail |
---|
public ExecutionContext(int scenario, java.lang.String context, PipeLayout layout, PipeAlgorithm algo)
scenario
- scenario idcontext
- context idlayout
- graph layout associated with this contextalgo
- pipe algorithm associated with this contextMethod Detail |
---|
public static boolean deleteDir(java.io.File dir, javax.swing.ProgressMonitor monitor)
dir
- directorymonitor
- the monitor
public void addChild(ExecutionContext mod)
mod
- the execution context (sync on tree)public void addContextListener(ExecutionContext.ContextListener listener)
listener
- listenerpublic void addParent(ExecutionContext mod)
mod
- the execution contextpublic void clean()
public void reset()
public int compareTo(ExecutionContext context)
compareTo
in interface java.lang.Comparable<ExecutionContext>
context
- the execution context
public void createTreeNodes(javax.swing.event.TreeSelectionListener listener)
listener
- tree event listener (sync tree)public void demote()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the execution context
public PipeAlgorithm getAlgorithm()
public int getAllocatedMemory()
public javax.swing.JTree getAncestorTree()
public java.util.Vector<ExecutionContext> getCallers()
public java.lang.String getContextId()
public ParamCollection getContextInputParams()
public java.lang.String getContextName()
public java.lang.String getContextShortName()
public java.lang.String getElapsedTimeDescription()
public java.util.Vector<ExecutionContext> getDependents()
public javax.swing.JTree getDescendantTree()
protected javax.swing.tree.TreePath getInitPath(javax.swing.tree.TreeNode node)
node
- root tree node
public java.io.File getInputLocation()
public ParamCollection getInputParamsFromFile()
public PipeLayout getLayout()
public java.io.File getOutputLocation()
public ParamCollection getOutputParamsFromFile()
public int getPriority()
public java.lang.Process getProcess()
public int getScenarioId()
public ExecutionContext.Status getStatus()
public javax.swing.JProgressBar getStatusBar()
public int getUsedMemory()
protected boolean isCompleted()
protected boolean checkInSync()
public boolean isOutOfSync()
protected boolean isReady()
protected boolean loadContextInputParams()
protected boolean loadContextOutputParams()
protected boolean loadLayoutInputParams()
public void notifyListeners(ExecutionContext.Update type)
type
- type of changepublic void promote()
public boolean push()
public void removeAllContextListeners()
public void removeListener(ExecutionContext.ContextListener listener)
listener
- listenerpublic void resetStatus()
public void restart()
public void run()
run
in interface java.lang.Runnable
protected java.io.File saveInputContext()
public void setAlgorithm(PipeAlgorithm module)
module
- algorithmpublic void setAllocatedMemory(int totalMemory)
totalMemory
- the total memorypublic void setContextId(java.lang.String contextId)
contextId
- context idpublic void setCpuTime(long cpuTime)
cpuTime
- timepublic void setActualTime(long actualTime)
actualTime
- timepublic long getCpuTime()
public long getActualTime()
public void setLayout(PipeLayout layout)
layout
- layout ownerpublic void setPriority(int priority)
priority
- prioritypublic void setProcess(java.lang.Process proc)
proc
- processpublic void setScenarioId(int scenarioId)
scenarioId
- scenario idpublic void setStatus(ExecutionContext.Status status)
status
- the statuspublic void setUsedMemory(int usedMemory)
usedMemory
- used memorypublic void start()
public void stop()
protected boolean synchronizedPush()
public java.lang.String toString()
toString
in class java.lang.Object
protected void updateAllTreeNodes()
public ExecutionContext.Status updateStatus()
protected void updateTreeNodes()
public java.lang.String getHashKey()
public static java.lang.String getHashKey(java.lang.String label, java.lang.Class c, ParamCollection currentParams)
label
- the labelc
- the ccurrentParams
- the current params
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |