Class FlowRunner

java.lang.Object
weka.knowledgeflow.FlowRunner
All Implemented Interfaces:
CommandlineRunnable, FlowExecutor
Direct Known Subclasses:
StepInjectorFlowRunner

public class FlowRunner extends 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)
  • Constructor Details

    • FlowRunner

      public FlowRunner()
      Constructor
    • FlowRunner

      public FlowRunner(Settings settings)
      Constructor
  • Method Details

    • setSettings

      public void setSettings(Settings settings)
      Set the settings to use when executing the Flow
      Specified by:
      setSettings in interface FlowExecutor
      Parameters:
      settings - the settings to use
    • getSettings

      public Settings getSettings()
      Get the settings in use when executing the Flow
      Specified by:
      getSettings in interface FlowExecutor
      Returns:
      the settings
    • setEnvironment

      public void setEnvironment(Environment env)
    • main

      public static void main(String[] args)
      Main method for executing the FlowRunner
      Parameters:
      args - command line arguments
    • run

      public void run(Object toRun, String[] args) throws Exception
      Run a FlowRunner object
      Specified by:
      run in interface CommandlineRunnable
      Parameters:
      toRun - the FlowRunner object to execute
      args - the command line arguments
      Throws:
      Exception - if a problem occurs
    • addExecutionFinishedCallback

      public void addExecutionFinishedCallback(ExecutionFinishedCallback callback)
      Set a callback to notify when flow execution finishes
      Specified by:
      addExecutionFinishedCallback in interface FlowExecutor
      Parameters:
      callback - the callback to notify
    • removeExecutionFinishedCallback

      public void removeExecutionFinishedCallback(ExecutionFinishedCallback callback)
      Remove a callback
      Specified by:
      removeExecutionFinishedCallback in interface FlowExecutor
      Parameters:
      callback - the callback to remove
    • getFlow

      public Flow getFlow()
      Get the flow to execute
      Specified by:
      getFlow in interface FlowExecutor
      Returns:
      the flow to execute
    • setFlow

      public void setFlow(Flow flow)
      Set the flow to execute
      Specified by:
      setFlow in interface FlowExecutor
      Parameters:
      flow - the flow to execute
    • getLogger

      public Logger getLogger()
      Get the log to use
      Specified by:
      getLogger in interface FlowExecutor
      Returns:
      the log to use
    • setLogger

      public void setLogger(Logger logger)
      Set the log to use
      Specified by:
      setLogger in interface FlowExecutor
      Parameters:
      logger - the log to use
    • getLoggingLevel

      public LoggingLevel getLoggingLevel()
      Get the logging level to use
      Specified by:
      getLoggingLevel in interface FlowExecutor
      Returns:
      the logging level to use
    • setLoggingLevel

      public void setLoggingLevel(LoggingLevel level)
      Set the logging level to use
      Specified by:
      setLoggingLevel in interface FlowExecutor
      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: FlowExecutor
      Return the execution environment object for this flow executor
      Specified by:
      getExecutionEnvironment in interface FlowExecutor
      Returns:
      the execution environment
    • setExecutionEnvironment

      public void setExecutionEnvironment(BaseExecutionEnvironment env)
      Set the execution environment to use
      Specified by:
      setExecutionEnvironment in interface FlowExecutor
      Parameters:
      env - the execution environment to use
    • run

      public void run() throws WekaException
      Execute the flow
      Throws:
      WekaException - if a problem occurs
    • runSequentially

      public void runSequentially() throws WekaException
      Run the flow by launching start points sequentially.
      Specified by:
      runSequentially in interface FlowExecutor
      Throws:
      WekaException - if a problem occurs
    • runParallel

      public void runParallel() throws WekaException
      Run the flow by launching start points in parallel
      Specified by:
      runParallel in interface FlowExecutor
      Throws:
      WekaException - if a problem occurs
    • waitUntilFinished

      public void waitUntilFinished()
      Wait until all the steps are no longer busy
      Specified by:
      waitUntilFinished in interface FlowExecutor
    • 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:
      stopProcessing in interface FlowExecutor
    • wasStopped

      public boolean wasStopped()
      Returns true if execution was stopped via the stopProcessing() method
      Specified by:
      wasStopped in interface FlowExecutor
      Returns:
      true if execution was stopped.
    • preExecution

      public void preExecution() throws Exception
      Description copied from interface: CommandlineRunnable
      Perform any setup stuff that might need to happen before execution.
      Specified by:
      preExecution in interface CommandlineRunnable
      Throws:
      Exception - if a problem occurs during setup
    • postExecution

      public void postExecution() throws Exception
      Description copied from interface: CommandlineRunnable
      Perform any teardown stuff that might need to happen after execution.
      Specified by:
      postExecution in interface CommandlineRunnable
      Throws:
      Exception - if a problem occurs during teardown