public abstract class ThreadedTableBuilderNodeModel extends NodeModel
NodeModelthat allows you to easily process data in parallel. In contrast to the
ThreadedColAppenderNodeModel, this model is suitable for creating completely new output tables. All you have to do is create the output table specs in the
prepareExecute(DataTable)method and then implement the
processRow(DataRow, BufferedDataTable, RowAppender)method to produce one or more (or even no) output row(s) for each input row.
|Constructor and Description|
Creates a new AbstractParallelNodeModel.
Creates a new AbstractParallelNodeModel.
|Modifier and Type||Method and Description|
This function is invoked by the
This method is called before the first row is processed.
This method is called once for each row in the first input table.
addWarningListener, computeFinalOutputSpecs, configure, configure, continueLoop, createInitialStreamableOperatorInternals, createMergeOperator, createStreamableOperator, execute, finishStreamableExecution, getAvailableFlowVariables, getAvailableInputFlowVariables, getCredentialsProvider, getInHiLiteHandler, getInPortType, getInputPortRoles, getInteractiveNodeView, getLogger, getLoopEndNode, getLoopStartNode, getNrInPorts, getNrOutPorts, getOutHiLiteHandler, getOutPortType, getOutputPortRoles, getWarningMessage, iterate, loadInternals, loadValidatedSettingsFrom, notifyViews, notifyWarningListeners, onDispose, peekFlowVariableDouble, peekFlowVariableInt, peekFlowVariableString, pushFlowVariableDouble, pushFlowVariableInt, pushFlowVariableString, removeWarningListener, reset, resetAndConfigureLoopBody, saveInternals, saveSettingsTo, setInHiLiteHandler, setWarningMessage, stateChanged, validateSettings
public ThreadedTableBuilderNodeModel(int nrDataIns, int nrDataOuts)
public ThreadedTableBuilderNodeModel(int nrDataIns, int nrDataOuts, ThreadPool workers)
protected final BufferedDataTable execute(BufferedDataTable data, ExecutionContext exec) throws Exception
Node#executeNode()method of the node (through the
#executeModel(BufferedDataTable,ExecutionMonitor)method) only after all predecessor nodes have been successfully executed and all data is therefore available at the input ports. Implement this function with your task in the derived model.
The input data is available in the given array argument
inData and is ensured to be neither
null nor contain
null elements (with few non-standard exception, which are described in
more detail in
In order to create output data, you need to create objects of class
BufferedDataTable. Use the
execution context argument to create
data- An array holding
DataTableelements, one for each input.
exec- The execution monitor for this execute method. It provides us with means to create new
BufferedDataTable. Additionally, it should be asked frequently if the execution should be interrupted and throws an exception then. This exception might me caught, and then after closing all data streams, been thrown again. Also, if you can tell the progress of your task, just set it in this monitor.
nullDataTable elements with the size of the number of outputs. The result of this execution.
Exception- If you must fail the execution. Try to provide a meaningful error message in the exception as it will be displayed to the user.Please be advised to check frequently the canceled status by invoking
ExecutionMonitor#checkCanceledwhich will throw an
CanceledExcecutionExceptionand abort the execution.
protected abstract DataTableSpec prepareExecute(DataTable data) throws Exception
processRow(DataRow, BufferedDataTable, RowAppender)must be constructed accordingly.
data- the input data tables
Exception- if something goes wrong during preparation
protected abstract void processRow(DataRow inRow, BufferedDataTable additionalData, RowAppender outputTables) throws Exception
inRow- an input row
additionalData- the complete tables of additional data
outputTables- data containers for the output tables where the computed rows must be added
Exception- if an exception occurs
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.