Package org.apache.hop.pipeline.engine
Interface IPipelineEngine<T extends PipelineMeta>
-
- Type Parameters:
T- The subject class to execute
- All Superinterfaces:
IExtensionData,ILoggingObject,INamedParameterDefinitions,INamedParameters,IVariables
- All Known Implementing Classes:
LocalPipelineEngine,LocalSinglePipelineEngine,Pipeline,RemotePipelineEngine
public interface IPipelineEngine<T extends PipelineMeta> extends IVariables, ILoggingObject, INamedParameters, IExtensionData
Describes the capabilities of an execution engine for a certain type of object called the subject
-
-
Field Summary
Fields Modifier and Type Field Description static StringPIPELINE_IN_PREVIEW_MODE
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddActiveSubPipeline(String transformName, IPipelineEngine executorPipeline)Add an active sub-pipeline to allow drill-down in the GUIvoidaddActiveSubWorkflow(String subWorkflowName, IWorkflowEngine<WorkflowMeta> subWorkflow)Add an active sub-workflow to allow drill-down in the GUI<Store extends IExecutionDataSamplerStore,Sampler extends IExecutionDataSampler<Store>>
voidaddExecutionDataSampler(Sampler sampler)Plugins can add individual data samplers which will act upon the rows passing through the transforms in the pipeline.voidaddExecutionFinishedListener(IExecutionFinishedListener<IPipelineEngine<T>> listener)Call the given listener lambda when this pipeline engine has completed execution.voidaddExecutionStartedListener(IExecutionStartedListener<IPipelineEngine<T>> listener)Call the given listener lambda when this pipeline engine has started execution.voidaddExecutionStoppedListener(IExecutionStoppedListener<IPipelineEngine<T>> listener)Call the given listener lambda when this pipeline engine has stopped execution.voidcleanup()This method performs any cleanup operations on the various sub-components of the engine after execution.IPipelineEngineRunConfigurationcreateDefaultPipelineEngineRunConfiguration()Ask the engine to generate a default pipeline engine configuration for this enginevoidexecute()Executes the object/subject: calls prepareExecution and startThreads in sequence.IEngineComponentfindComponent(String name, int copyNr)Find a component by name and copy nrIRowSetfindRowSet(String fromTransformName, int fromTransformCopy, String toTransformName, int toTransformCopy)For engines that support it we allow the retrieval of a rowset from one transform copy to anothervoidfirePipelineExecutionFinishedListeners()voidfirePipelineExecutionStartedListeners()voidfirePipelineExecutionStoppedListeners()IPipelineEnginegetActiveSubPipeline(String subPipelineName)Get the active sub-pipeline with the given nameIWorkflowEngine<WorkflowMeta>getActiveSubWorkflow(String subWorkflowName)Get the active sub-workflow with the given nameList<IEngineComponent>getComponentCopies(String name)Find all component copies by nameStringgetComponentLogText(String componentName, int copyNr)Retrieve the logging text of a particular component in the engineList<IEngineComponent>getComponents()Get a list of componentsPipelineEngineCapabilitiesgetEngineCapabilities()See which operations are supported by the pipeline engine.EngineMetricsgetEngineMetrics()Collect metrics from the various components in the engine.EngineMetricsgetEngineMetrics(String componentName, int copyNr)Get the engine metrics for a specific component name and/or copy nrintgetErrors()DategetExecutionEndDate()DategetExecutionStartDate()Map<String,Object>getExtensionDataMap()A map in which the various transforms and plugins can store objects to remember during the lifecycle of the pipeline.intgetFeedbackSize()Deprecated.ILogChannelgetLogChannel()Gets the log channel interface for the pipeline.StringgetLogChannelId()The log channel ID if there is anyLogLevelgetLogLevel()IHopMetadataProvidergetMetadataProvider()IPipelineEngine<T>getParentPipeline()Determine the pipeline engine which is executing this pipeline engine.IWorkflowEngine<WorkflowMeta>getParentWorkflow()Determine the workflow engine which is executing this pipeline engine.TgetPipelineMeta()PipelineRunConfigurationgetPipelineRunConfiguration()StringgetPluginId()ResultgetPreviousResult()Get the execution result of a previous execution in a workflowResultgetResult()Get the result of the execution after it's done, a resumeStringgetStatusDescription()booleanhasHaltedComponents()See if there are any halted components in the engine: actions, auditing, ...booleanisFeedbackShown()Deprecated.booleanisFinished()See if the engine has finished executing.booleanisPaused()See if the engine is pausedbooleanisPreparing()booleanisPreview()Deprecated.booleanisReadyToStart()Check to see if the pipeline engine is ready to start threads.booleanisRunning()Indicates whether or not the engine is runningbooleanisSafeModeEnabled()True if the engine is doing extra validations at runtime to detect possible issues with data types and so on.booleanisStopped()Indicates whether or not the engine is stopped.voidpauseExecution()Pauses the execution (all components).voidpipelineCompleted()This method is called when all the finished listeners are executed and when the pipeline has completed.voidprepareExecution()Prepares for execution.voidresumeExecution()Resume the execution (all components).voidretrieveComponentOutput(IVariables variables, String componentName, int copyNr, int nrRows, IPipelineComponentRowsReceived rowsReceived)Retrieve output rows from a component copy.voidsetContainerId(String containerId)The unique ID this pipeline engine has while executing in a container like a web-server and so on.voidsetInternalHopVariables(IVariables var)Make the engine define internal hop variables based on the given variables, the filename and so onvoidsetLogChannel(ILogChannel log)Sets the log channel.voidsetLogLevel(LogLevel logLevel)voidsetMetadataProvider(IHopMetadataProvider metadataProvider)voidsetParent(ILoggingObject parent)Sets the parent logging object.voidsetParentPipeline(IPipelineEngine parentPipeline)Inform the pipeline that it's being executed as part of another pipelinevoidsetParentWorkflow(IWorkflowEngine<WorkflowMeta> parentWorkflow)Inform the pipeline that it's being executed as part of a workflowvoidsetPipelineMeta(T t)voidsetPipelineRunConfiguration(PipelineRunConfiguration pipelineRunConfiguration)voidsetPluginId(String pluginId)voidsetPreview(boolean preview)Deprecated.voidsetPreviousResult(Result previousResult)Inform the pipeline about a previous execution result in a workflow or pipelinevoidstartThreads()Starts the engine itself after prepareExecution.voidstopAll()Stops all parts of the execution from running and alerts any registered listeners.voidwaitUntilFinished()Wait until the execution is done.-
Methods inherited from interface org.apache.hop.core.logging.ILoggingObject
getContainerId, getFilename, getObjectCopy, getObjectName, getObjectType, getParent, getRegistrationDate, isForcingSeparateLogging, isGatheringMetrics, setForcingSeparateLogging, setGatheringMetrics
-
Methods inherited from interface org.apache.hop.core.parameters.INamedParameterDefinitions
addParameterDefinition, getParameterDefault, getParameterDescription, listParameters
-
Methods inherited from interface org.apache.hop.core.parameters.INamedParameters
activateParameters, clearParameterValues, copyParametersFromDefinitions, getParameterValue, removeAllParameters, setParameterValue
-
Methods inherited from interface org.apache.hop.core.variables.IVariables
copyFrom, getParentVariables, getVariable, getVariable, getVariableBoolean, getVariableNames, initializeFrom, resolve, resolve, resolve, setParentVariables, setVariable, setVariables, shareWith
-
-
-
-
Field Detail
-
PIPELINE_IN_PREVIEW_MODE
static final String PIPELINE_IN_PREVIEW_MODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPipelineMeta
T getPipelineMeta()
-
setPipelineMeta
void setPipelineMeta(T t)
-
getPluginId
String getPluginId()
-
setPluginId
void setPluginId(String pluginId)
-
createDefaultPipelineEngineRunConfiguration
IPipelineEngineRunConfiguration createDefaultPipelineEngineRunConfiguration()
Ask the engine to generate a default pipeline engine configuration for this engine- Returns:
- a new pipeline engine run configuration
-
setPipelineRunConfiguration
void setPipelineRunConfiguration(PipelineRunConfiguration pipelineRunConfiguration)
-
getPipelineRunConfiguration
PipelineRunConfiguration getPipelineRunConfiguration()
-
getEngineCapabilities
PipelineEngineCapabilities getEngineCapabilities()
See which operations are supported by the pipeline engine.- Returns:
- The engine capabilities
-
execute
void execute() throws HopExceptionExecutes the object/subject: calls prepareExecution and startThreads in sequence.- Throws:
HopException- if the object execution could not be prepared (initialized)
-
prepareExecution
void prepareExecution() throws HopExceptionPrepares for execution. This includes setting the parameters as well as preparing anything needed in terms of resources, threads,.... It runs initialization on all the work that is needed to be done up-front.- Throws:
HopException- In case of an initialization error
-
isPreparing
boolean isPreparing()
- Returns:
- true if the engine is preparing execution
-
isReadyToStart
boolean isReadyToStart()
Check to see if the pipeline engine is ready to start threads.- Returns:
- True if the pipeline engine was prepared and is ready to start.
-
startThreads
void startThreads() throws HopExceptionStarts the engine itself after prepareExecution.- Throws:
HopException- If there is an engine error during execution.
-
getEngineMetrics
EngineMetrics getEngineMetrics()
Collect metrics from the various components in the engine.- Returns:
- The engine metrics
-
getEngineMetrics
EngineMetrics getEngineMetrics(String componentName, int copyNr)
Get the engine metrics for a specific component name and/or copy nr- Parameters:
componentName- the name of the component or null for all componentscopyNr- The copy nr to select or a negative number for all components- Returns:
- The engine metrics for the given
-
cleanup
void cleanup()
This method performs any cleanup operations on the various sub-components of the engine after execution.
-
waitUntilFinished
void waitUntilFinished()
Wait until the execution is done.
-
pipelineCompleted
void pipelineCompleted() throws HopExceptionThis method is called when all the finished listeners are executed and when the pipeline has completed.- Throws:
HopException
-
stopAll
void stopAll()
Stops all parts of the execution from running and alerts any registered listeners.
-
hasHaltedComponents
boolean hasHaltedComponents()
See if there are any halted components in the engine: actions, auditing, ...- Returns:
- True if there are halted components
-
isRunning
boolean isRunning()
Indicates whether or not the engine is running- Returns:
- True is the engine is running
-
isStopped
boolean isStopped()
Indicates whether or not the engine is stopped.- Returns:
- True is the engine execution has stopped
-
pauseExecution
void pauseExecution()
Pauses the execution (all components).
-
resumeExecution
void resumeExecution()
Resume the execution (all components).
-
getErrors
int getErrors()
- Returns:
- a number larger than 0 in case of errors
-
isFinished
boolean isFinished()
See if the engine has finished executing.- Returns:
- True if the execution has finished
-
isPaused
boolean isPaused()
See if the engine is paused- Returns:
- true if the engine is paused
-
addExecutionStartedListener
void addExecutionStartedListener(IExecutionStartedListener<IPipelineEngine<T>> listener) throws HopException
Call the given listener lambda when this pipeline engine has started execution.- Parameters:
listener-- Throws:
HopException
-
firePipelineExecutionStartedListeners
void firePipelineExecutionStartedListeners() throws HopException- Throws:
HopException
-
addExecutionFinishedListener
void addExecutionFinishedListener(IExecutionFinishedListener<IPipelineEngine<T>> listener) throws HopException
Call the given listener lambda when this pipeline engine has completed execution.- Parameters:
listener-- Throws:
HopException
-
firePipelineExecutionFinishedListeners
void firePipelineExecutionFinishedListeners() throws HopException- Throws:
HopException
-
addExecutionStoppedListener
void addExecutionStoppedListener(IExecutionStoppedListener<IPipelineEngine<T>> listener) throws HopException
Call the given listener lambda when this pipeline engine has stopped execution.- Parameters:
listener-- Throws:
HopException
-
firePipelineExecutionStoppedListeners
void firePipelineExecutionStoppedListeners() throws HopException- Throws:
HopException
-
getComponentLogText
String getComponentLogText(String componentName, int copyNr)
Retrieve the logging text of a particular component in the engine- Parameters:
componentName- The name of the component (transform)copyNr- The copy number if multiple components are running in parallel (0 based).- Returns:
- The logging text
-
getComponents
List<IEngineComponent> getComponents()
Get a list of components- Returns:
- The list of components in the engine
-
getComponentCopies
List<IEngineComponent> getComponentCopies(String name)
Find all component copies by name- Parameters:
name- The name of the component to look for (transform)- Returns:
- The list of components found
-
findComponent
IEngineComponent findComponent(String name, int copyNr)
Find a component by name and copy nr- Parameters:
name- The name of the component to look for (transform)copyNr- The copy number to match- Returns:
- The component or null if nothing was found
-
getLogChannel
ILogChannel getLogChannel()
Gets the log channel interface for the pipeline.- Returns:
- the log channel
-
setLogChannel
void setLogChannel(ILogChannel log)
Sets the log channel. For testing only- Parameters:
log-
-
getLogChannelId
String getLogChannelId()
The log channel ID if there is any- Specified by:
getLogChannelIdin interfaceILoggingObject- Returns:
-
setParent
void setParent(ILoggingObject parent)
Sets the parent logging object.- Parameters:
parent- the new parent
-
setParentWorkflow
void setParentWorkflow(IWorkflowEngine<WorkflowMeta> parentWorkflow)
Inform the pipeline that it's being executed as part of a workflow- Parameters:
parentWorkflow-
-
setParentPipeline
void setParentPipeline(IPipelineEngine parentPipeline)
Inform the pipeline that it's being executed as part of another pipeline- Parameters:
parentPipeline-
-
setPreviousResult
void setPreviousResult(Result previousResult)
Inform the pipeline about a previous execution result in a workflow or pipeline- Parameters:
previousResult-
-
getResult
Result getResult()
Get the result of the execution after it's done, a resume- Returns:
- The Result of the execution of the object
-
setMetadataProvider
void setMetadataProvider(IHopMetadataProvider metadataProvider)
-
getMetadataProvider
IHopMetadataProvider getMetadataProvider()
-
setLogLevel
void setLogLevel(LogLevel logLevel)
-
getLogLevel
LogLevel getLogLevel()
- Specified by:
getLogLevelin interfaceILoggingObject
-
setPreview
@Deprecated(since="2.0") void setPreview(boolean preview)
Deprecated.Temporary until we find a better way to preview/debug- Parameters:
preview-
-
isPreview
@Deprecated(since="2.0") boolean isPreview()
Deprecated.Temporary until we find a better way to preview/debug- Returns:
-
retrieveComponentOutput
void retrieveComponentOutput(IVariables variables, String componentName, int copyNr, int nrRows, IPipelineComponentRowsReceived rowsReceived) throws HopException
Retrieve output rows from a component copy. Pass the rows to the rows received lambda.- Parameters:
variables-componentName-copyNr-nrRows-rowsReceived-- Throws:
HopException
-
getParentPipeline
IPipelineEngine<T> getParentPipeline()
Determine the pipeline engine which is executing this pipeline engine.- Returns:
- The executing pipeline or null if none is known.
-
getParentWorkflow
IWorkflowEngine<WorkflowMeta> getParentWorkflow()
Determine the workflow engine which is executing this pipeline engine.- Returns:
- The executing workflow of null if none is known.
-
isSafeModeEnabled
boolean isSafeModeEnabled()
True if the engine is doing extra validations at runtime to detect possible issues with data types and so on.- Returns:
- True if safe mode is enabled.
-
findRowSet
IRowSet findRowSet(String fromTransformName, int fromTransformCopy, String toTransformName, int toTransformCopy)
For engines that support it we allow the retrieval of a rowset from one transform copy to another- Parameters:
fromTransformName-fromTransformCopy-toTransformName-toTransformCopy-- Returns:
- The rowset if one was found.
- Throws:
RuntimeException- in case the engine doesn't support this operation.
-
isFeedbackShown
@Deprecated(since="2.0") boolean isFeedbackShown()
Deprecated.True if feedback need to be given every X rows- Returns:
- True if feedback needs to be given
-
getFeedbackSize
@Deprecated(since="2.0") int getFeedbackSize()
Deprecated.The feedback size in rows- Returns:
- The feedback size in rows
-
getPreviousResult
Result getPreviousResult()
Get the execution result of a previous execution in a workflow- Returns:
- the previous execution result
-
getExecutionStartDate
Date getExecutionStartDate()
- Returns:
- The start date of the pipeline execution
-
getExecutionEndDate
Date getExecutionEndDate()
- Returns:
- The end date of the pipeline preparation
-
addActiveSubPipeline
void addActiveSubPipeline(String transformName, IPipelineEngine executorPipeline)
Add an active sub-pipeline to allow drill-down in the GUI- Parameters:
transformName-executorPipeline-
-
getActiveSubPipeline
IPipelineEngine getActiveSubPipeline(String subPipelineName)
Get the active sub-pipeline with the given name- Parameters:
subPipelineName-- Returns:
- The active pipeline engine or null if it was not found
-
addActiveSubWorkflow
void addActiveSubWorkflow(String subWorkflowName, IWorkflowEngine<WorkflowMeta> subWorkflow)
Add an active sub-workflow to allow drill-down in the GUI- Parameters:
subWorkflowName-subWorkflow-
-
getActiveSubWorkflow
IWorkflowEngine<WorkflowMeta> getActiveSubWorkflow(String subWorkflowName)
Get the active sub-workflow with the given name- Parameters:
subWorkflowName-- Returns:
- The active workflow or null if nothing was found
-
setInternalHopVariables
void setInternalHopVariables(IVariables var)
Make the engine define internal hop variables based on the given variables, the filename and so on- Parameters:
var- TODO get rid of this method, internal variables should be available
-
setContainerId
void setContainerId(String containerId)
The unique ID this pipeline engine has while executing in a container like a web-server and so on. When we have multiple pipelines running with the same name- Parameters:
containerId- The unique ID to identify this executing engine with
-
getStatusDescription
String getStatusDescription()
- Returns:
- Get a status description of the state of the engine (running, stopped, finished, paused, halted, ...)
-
getExtensionDataMap
Map<String,Object> getExtensionDataMap()
A map in which the various transforms and plugins can store objects to remember during the lifecycle of the pipeline. TODO This is obviously harder to do in a clustered or remote execution environment. As such it's not clear that it makes sense to leave this method here over time- Specified by:
getExtensionDataMapin interfaceIExtensionData- Returns:
- The extension data map to use
-
addExecutionDataSampler
<Store extends IExecutionDataSamplerStore,Sampler extends IExecutionDataSampler<Store>> void addExecutionDataSampler(Sampler sampler) throws HopException
Plugins can add individual data samplers which will act upon the rows passing through the transforms in the pipeline. The execution information collected at this level will be sent to the execution information location if any is defined in the run configuration used to execute this pipeline.- Parameters:
sampler- The sampler to use- Throws:
HopException
-
-