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 and Description
    --- | ---
    `static class` | `FlowRunner.SimpleLogger` A simple logging implementation that writes to standard out

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FlowRunner()` Constructor
    `FlowRunner(Settings settings)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addExecutionFinishedCallback(ExecutionFinishedCallback callback)` Set a callback to notify when flow execution finishes
    `boolean` | `flowBusy()` Checks to see if any step(s) are doing work
    `BaseExecutionEnvironment` | `getExecutionEnvironment()` Return the execution environment object for this flow executor
    `Flow` | `getFlow()` Get the flow to execute
    `boolean` | `getLaunchStartPointsSequentially()` Get whether to launch start points sequentially
    `Logger` | `getLogger()` Get the log to use
    `LoggingLevel` | `getLoggingLevel()` Get the logging level to use
    `Settings` | `getSettings()` Get the settings in use when executing the Flow
    `static void` | `main(java.lang.String[] args)` Main method for executing the FlowRunner
    `void` | `postExecution()` Perform any teardown stuff that might need to happen after execution.
    `void` | `preExecution()` Perform any setup stuff that might need to happen before execution.
    `void` | `removeExecutionFinishedCallback(ExecutionFinishedCallback callback)` Remove a callback
    `void` | `run()` Execute the flow
    `void` | `run(java.lang.Object toRun, java.lang.String[] args)` Run a FlowRunner object
    `void` | `runParallel()` Run the flow by launching start points in parallel
    `void` | `runSequentially()` Run the flow by launching start points sequentially.
    `void` | `setExecutionEnvironment(BaseExecutionEnvironment env)` Set the execution environment to use
    `void` | `setFlow(Flow flow)` Set the flow to execute
    `void` | `setLaunchStartPointsSequentially(boolean s)` Set whether to launch start points sequentially
    `void` | `setLogger(Logger logger)` Set the log to use
    `void` | `setLoggingLevel(LoggingLevel level)` Set the logging level to use
    `void` | `setSettings(Settings settings)` Set the settings to use when executing the Flow
    `void` | `stopProcessing()` Attempt to stop processing in all steps
    `void` | `waitUntilFinished()` Wait until all the steps are no longer busy
    `boolean` | `wasStopped()` Returns true if execution was stopped via the stopProcessing() method

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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:
        `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

    - #### 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.Exception

      Run a FlowRunner object
      Specified by:
        `run` in interface `CommandlineRunnable`
      Parameters:
        `toRun` - the FlowRunner object to execute
        `args` - 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:
        `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 java.lang.Exception

      Description copied from interface: `CommandlineRunnable`
      Perform any setup stuff that might need to happen before execution.
      Specified by:
        `preExecution` in interface `CommandlineRunnable`
      Throws:
        `java.lang.Exception` - if a problem occurs during setup

    - #### postExecution

          public void postExecution()
                             throws java.lang.Exception

      Description copied from interface: `CommandlineRunnable`
      Perform any teardown stuff that might need to happen after execution.
      Specified by:
        `postExecution` in interface `CommandlineRunnable`
      Throws:
        `java.lang.Exception` - if a problem occurs during teardown