public class BaseExecutionEnvironment extends java.lang.Object implements ExecutionEnvironment
| Modifier and Type | Class and Description |
|---|---|
static class |
BaseExecutionEnvironment.BaseExecutionEnvironmentDefaults
Defaults for the base execution environment
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DESCRIPTION
Description of the default execution environment
|
protected java.util.concurrent.ExecutorService |
m_clientExecutorService
An executor service that steps can use to do work in parallel (if desired)
by using
StepTask instances. |
protected Environment |
m_envVars
The environment variables to use
|
protected java.util.concurrent.ExecutorService |
m_executorService
This is the main executor service, used by the execution environment to
invoke processIncoming() on a step when batch data is passed to it - i.e. a
step receiving data will execute in its own thread.
|
protected FlowExecutor |
m_flowExecutor
The FlowExecutor that will be running the flow.
|
protected GraphicalEnvironmentCommandHandler |
m_graphicalEnvCommandHandler
The handler (if any) for application-level commands in a graphical
environment
|
protected boolean |
m_headless
Whether the execution environment is headless or not
|
protected Logger |
m_log
The log
|
protected LoggingLevel |
m_loggingLevel
The level to log at
|
protected LogManager |
m_logHandler
Log handler to wrap log in
|
protected Settings |
m_settings
The knowledge flow settings to use
|
protected java.util.concurrent.ExecutorService |
m_singleThreadService
An executor service with a single worker thread.
|
| Constructor and Description |
|---|
BaseExecutionEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
FlowExecutor |
getDefaultFlowExecutor()
Gets a new instance of the default flow executor suitable for use with this
execution environment
|
Defaults |
getDefaultSettings()
Get default settings for the base execution environment
|
java.lang.String |
getDescription()
Get a description of this execution environment
|
Environment |
getEnvironmentVariables()
Get environment variables for this execution environment
|
FlowExecutor |
getFlowExecutor()
Get the executor that will actually be responsible for running the flow.
|
GraphicalEnvironmentCommandHandler |
getGraphicalEnvironmentCommandHandler()
Get the environment for performing commands at the application-level in a
graphical environment.
|
Logger |
getLog()
Get the log in use
|
LoggingLevel |
getLoggingLevel()
Get the logging level in use
|
Settings |
getSettings()
Get knowledge flow settings for this execution environment
|
boolean |
isHeadless()
Get whether this execution environment is headless
|
protected void |
launchStartPoint(StepManagerImpl startPoint)
Launches a Step (via the startStep() method) in either than standard step
executor service or the resource intensive executor service.
|
protected void |
sendDataToStep(StepManagerImpl step,
Data... data)
Send the supplied data to the specified step.
|
void |
setEnvironmentVariables(Environment env)
Set environment variables for this execution environment
|
void |
setFlowExecutor(FlowExecutor executor)
Set the executor that will actually be responsible for running the flow.
|
void |
setGraphicalEnvironmentCommandHandler(GraphicalEnvironmentCommandHandler handler)
Set the environment for performing commands at the application-level in a
graphical environment.
|
void |
setHeadless(boolean headless)
Set whether this execution environment is headless
|
void |
setLog(Logger log)
Set the log to use
|
void |
setLoggingLevel(LoggingLevel level)
Set the logging level to use
|
void |
setSettings(Settings settings)
Set knowledge flow settings for this execution environment
|
protected void |
startClientExecutionService(int numThreadsMain,
int numThreadsHighLoad)
Start the main step executor service and the high cpu load executor service
for clients to use to execute
StepTask instances in this execution
environment. |
protected void |
stopClientExecutionService()
Stop the client executor service
|
void |
stopProcessing()
The main point at which to request stop processing of a flow.
|
<T> java.util.concurrent.Future<ExecutionResult<T>> |
submitTask(StepTask<T> stepTask)
Submit a task to be run by the execution environment.
|
public static final java.lang.String DESCRIPTION
protected FlowExecutor m_flowExecutor
protected boolean m_headless
protected GraphicalEnvironmentCommandHandler m_graphicalEnvCommandHandler
protected transient Environment m_envVars
protected transient Settings m_settings
protected transient java.util.concurrent.ExecutorService m_executorService
protected transient java.util.concurrent.ExecutorService m_clientExecutorService
StepTask instances. This executor service is intended for
high cpu load tasks, and the number of threads used by it should be kept <=
number of physical CPU coresprotected transient java.util.concurrent.ExecutorService m_singleThreadService
SingleThreadedExecution annotation,
which effectively limits one object of the type in question to be executing
in the KnowledgeFlow/JVM at any one time.protected transient Logger m_log
protected transient LogManager m_logHandler
protected LoggingLevel m_loggingLevel
public java.lang.String getDescription()
getDescription in interface ExecutionEnvironmentpublic boolean isHeadless()
isHeadless in interface ExecutionEnvironmentpublic void setHeadless(boolean headless)
setHeadless in interface ExecutionEnvironmentheadless - true if the execution environment is headlesspublic GraphicalEnvironmentCommandHandler getGraphicalEnvironmentCommandHandler()
getGraphicalEnvironmentCommandHandler in interface ExecutionEnvironmentpublic void setGraphicalEnvironmentCommandHandler(GraphicalEnvironmentCommandHandler handler)
setGraphicalEnvironmentCommandHandler in interface ExecutionEnvironmentpublic Environment getEnvironmentVariables()
getEnvironmentVariables in interface ExecutionEnvironmentpublic void setEnvironmentVariables(Environment env)
setEnvironmentVariables in interface ExecutionEnvironmentenv - the environment variables to usepublic void setSettings(Settings settings)
ExecutionEnvironmentsetSettings in interface ExecutionEnvironmentsettings - the settings to usepublic Settings getSettings()
ExecutionEnvironmentgetSettings in interface ExecutionEnvironmentpublic Logger getLog()
getLog in interface ExecutionEnvironmentpublic void setLog(Logger log)
setLog in interface ExecutionEnvironmentlog - the log to usepublic LoggingLevel getLoggingLevel()
getLoggingLevel in interface ExecutionEnvironmentpublic void setLoggingLevel(LoggingLevel level)
setLoggingLevel in interface ExecutionEnvironmentlevel - the logging level to usepublic <T> java.util.concurrent.Future<ExecutionResult<T>> submitTask(StepTask<T> stepTask) throws WekaException
submitTask in interface ExecutionEnvironmentstepTask - the StepTask encapsulating the code to be runWekaException - if processing fails in the case ofpublic void stopProcessing()
stopProcessing in interface ExecutionEnvironmentpublic FlowExecutor getDefaultFlowExecutor()
public FlowExecutor getFlowExecutor()
public void setFlowExecutor(FlowExecutor executor)
executor - the executor that will be running the flowprotected void startClientExecutionService(int numThreadsMain,
int numThreadsHighLoad)
StepTask instances in this execution
environment. Client steps are free to use this service or to just do their
processing locally within their own code (in which case the main step
executor service is used).numThreadsMain - the number of threads to use (level of parallelism).
<= 0 indicates no limit on parallelismnumThreadsHighLoad - the number of threads to use for the high cpu
load executor service (executes StepTask instances)protected void stopClientExecutionService()
protected void launchStartPoint(StepManagerImpl startPoint) throws WekaException
startPoint - the step to launch as a start pointWekaException - if a problem occursprotected void sendDataToStep(StepManagerImpl step, Data... data) throws WekaException
data - the data to input to the target stepstep - the step to receive dataWekaException - if a problem occurspublic Defaults getDefaultSettings()
getDefaultSettings in interface ExecutionEnvironment