Package weka.knowledgeflow
Class FlowRunner
- java.lang.Object
-
- weka.knowledgeflow.FlowRunner
-
- All Implemented Interfaces:
CommandlineRunnable,FlowExecutor
- Direct Known Subclasses:
StepInjectorFlowRunner
public class FlowRunner extends java.lang.Object implements FlowExecutor, CommandlineRunnable
A FlowExecutor that can launch start points in a flow in parallel or sequentially.- Version:
- $Revision: $
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFlowRunner.SimpleLoggerA simple logging implementation that writes to standard out
-
Constructor Summary
Constructors Constructor Description FlowRunner()ConstructorFlowRunner(Settings settings)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExecutionFinishedCallback(ExecutionFinishedCallback callback)Set a callback to notify when flow execution finishesbooleanflowBusy()Checks to see if any step(s) are doing workBaseExecutionEnvironmentgetExecutionEnvironment()Return the execution environment object for this flow executorFlowgetFlow()Get the flow to executebooleangetLaunchStartPointsSequentially()Get whether to launch start points sequentiallyLoggergetLogger()Get the log to useLoggingLevelgetLoggingLevel()Get the logging level to useSettingsgetSettings()Get the settings in use when executing the Flowstatic voidmain(java.lang.String[] args)Main method for executing the FlowRunnervoidpostExecution()Perform any teardown stuff that might need to happen after execution.voidpreExecution()Perform any setup stuff that might need to happen before execution.voidremoveExecutionFinishedCallback(ExecutionFinishedCallback callback)Remove a callbackvoidrun()Execute the flowvoidrun(java.lang.Object toRun, java.lang.String[] args)Run a FlowRunner objectvoidrunParallel()Run the flow by launching start points in parallelvoidrunSequentially()Run the flow by launching start points sequentially.voidsetExecutionEnvironment(BaseExecutionEnvironment env)Set the execution environment to usevoidsetFlow(Flow flow)Set the flow to executevoidsetLaunchStartPointsSequentially(boolean s)Set whether to launch start points sequentiallyvoidsetLogger(Logger logger)Set the log to usevoidsetLoggingLevel(LoggingLevel level)Set the logging level to usevoidsetSettings(Settings settings)Set the settings to use when executing the FlowvoidstopProcessing()Attempt to stop processing in all stepsvoidwaitUntilFinished()Wait until all the steps are no longer busybooleanwasStopped()Returns true if execution was stopped via the stopProcessing() method
-
-
-
Constructor Detail
-
FlowRunner
public FlowRunner()
Constructor
-
FlowRunner
public FlowRunner(Settings settings)
Constructor
-
-
Method Detail
-
setSettings
public void setSettings(Settings settings)
Set the settings to use when executing the Flow- Specified by:
setSettingsin interfaceFlowExecutor- Parameters:
settings- the settings to use
-
getSettings
public Settings getSettings()
Get the settings in use when executing the Flow- Specified by:
getSettingsin interfaceFlowExecutor- Returns:
- the settings
-
main
public static void main(java.lang.String[] args)
Main method for executing the FlowRunner- Parameters:
args- command line arguments
-
run
public void run(java.lang.Object toRun, java.lang.String[] args) throws java.lang.ExceptionRun a FlowRunner object- Specified by:
runin interfaceCommandlineRunnable- Parameters:
toRun- the FlowRunner object to executeargs- the command line arguments- Throws:
java.lang.Exception- if a problem occurs
-
addExecutionFinishedCallback
public void addExecutionFinishedCallback(ExecutionFinishedCallback callback)
Set a callback to notify when flow execution finishes- Specified by:
addExecutionFinishedCallbackin interfaceFlowExecutor- Parameters:
callback- the callback to notify
-
removeExecutionFinishedCallback
public void removeExecutionFinishedCallback(ExecutionFinishedCallback callback)
Remove a callback- Specified by:
removeExecutionFinishedCallbackin interfaceFlowExecutor- Parameters:
callback- the callback to remove
-
getFlow
public Flow getFlow()
Get the flow to execute- Specified by:
getFlowin interfaceFlowExecutor- Returns:
- the flow to execute
-
setFlow
public void setFlow(Flow flow)
Set the flow to execute- Specified by:
setFlowin interfaceFlowExecutor- Parameters:
flow- the flow to execute
-
getLogger
public Logger getLogger()
Get the log to use- Specified by:
getLoggerin interfaceFlowExecutor- Returns:
- the log to use
-
setLogger
public void setLogger(Logger logger)
Set the log to use- Specified by:
setLoggerin interfaceFlowExecutor- Parameters:
logger- the log to use
-
getLoggingLevel
public LoggingLevel getLoggingLevel()
Get the logging level to use- Specified by:
getLoggingLevelin interfaceFlowExecutor- Returns:
- the logging level to use
-
setLoggingLevel
public void setLoggingLevel(LoggingLevel level)
Set the logging level to use- Specified by:
setLoggingLevelin interfaceFlowExecutor- Parameters:
level- the logging level to use
-
getLaunchStartPointsSequentially
public boolean getLaunchStartPointsSequentially()
Get whether to launch start points sequentially- Returns:
- true if start points are to be launched sequentially
-
setLaunchStartPointsSequentially
public void setLaunchStartPointsSequentially(boolean s)
Set whether to launch start points sequentially- Parameters:
s- true if start points are to be launched sequentially
-
getExecutionEnvironment
public BaseExecutionEnvironment getExecutionEnvironment()
Description copied from interface:FlowExecutorReturn the execution environment object for this flow executor- Specified by:
getExecutionEnvironmentin interfaceFlowExecutor- Returns:
- the execution environment
-
setExecutionEnvironment
public void setExecutionEnvironment(BaseExecutionEnvironment env)
Set the execution environment to use- Specified by:
setExecutionEnvironmentin interfaceFlowExecutor- Parameters:
env- the execution environment to use
-
run
public void run() throws WekaExceptionExecute the flow- Throws:
WekaException- if a problem occurs
-
runSequentially
public void runSequentially() throws WekaExceptionRun the flow by launching start points sequentially.- Specified by:
runSequentiallyin interfaceFlowExecutor- Throws:
WekaException- if a problem occurs
-
runParallel
public void runParallel() throws WekaExceptionRun the flow by launching start points in parallel- Specified by:
runParallelin interfaceFlowExecutor- Throws:
WekaException- if a problem occurs
-
waitUntilFinished
public void waitUntilFinished()
Wait until all the steps are no longer busy- Specified by:
waitUntilFinishedin interfaceFlowExecutor
-
flowBusy
public boolean flowBusy()
Checks to see if any step(s) are doing work- Returns:
- true if one or more steps in the flow are busy
-
stopProcessing
public void stopProcessing()
Attempt to stop processing in all steps- Specified by:
stopProcessingin interfaceFlowExecutor
-
wasStopped
public boolean wasStopped()
Returns true if execution was stopped via the stopProcessing() method- Specified by:
wasStoppedin interfaceFlowExecutor- Returns:
- true if execution was stopped.
-
preExecution
public void preExecution() throws java.lang.ExceptionDescription copied from interface:CommandlineRunnablePerform any setup stuff that might need to happen before execution.- Specified by:
preExecutionin interfaceCommandlineRunnable- Throws:
java.lang.Exception- if a problem occurs during setup
-
postExecution
public void postExecution() throws java.lang.ExceptionDescription copied from interface:CommandlineRunnablePerform any teardown stuff that might need to happen after execution.- Specified by:
postExecutionin interfaceCommandlineRunnable- Throws:
java.lang.Exception- if a problem occurs during teardown
-
-