T
- The sub type of the internals used by the implementationpublic abstract class SimpleStreamableFunctionWithInternalsNodeModel<T extends StreamableOperatorInternals> extends SimpleStreamableFunctionNodeModel
Constructor and Description |
---|
SimpleStreamableFunctionWithInternalsNodeModel(Class<T> cl)
New node model (one in, one out).
|
SimpleStreamableFunctionWithInternalsNodeModel(Class<T> cl,
PortType[] inPortTypes,
PortType[] outPortTypes,
int streamableInPortIdx,
int streamableOutPortIdx)
Constructor for a node with multiple in or out ports.
|
Modifier and Type | Method and Description |
---|---|
protected ColumnRearranger |
createColumnRearranger(DataTableSpec spec)
Creates a column rearranger that describes the changes to the input table.
|
protected abstract ColumnRearranger |
createColumnRearranger(DataTableSpec spec,
T emptyInternals)
Extends the behavior of
SimpleStreamableFunctionNodeModel.createColumnRearranger(DataTableSpec) by an
empty internals object that is filled while processing the data. |
MergeOperator |
createMergeOperator()
Streaming API (pending):
Factory method to create a merge operator that combines results created
in different
StreamableOperator objects. |
StreamableFunction |
createStreamableOperator(PartitionInfo partitionInfo,
PortObjectSpec[] inSpecs)
Streaming API (pending):
Factory method for a streamable operator that is used to execute this
node.
|
protected T |
createStreamingOperatorInternals()
Creates new empty instance of the internals.
|
void |
finishStreamableExecution(StreamableOperatorInternals internals,
ExecutionContext exec,
PortOutput[] output)
Streaming API (pending):
Called by the executor if the data is processed in a distributed fashion
to create the final output result or update node internals (for instance
a warning message or view content).
|
protected abstract void |
finishStreamableExecution(T operatorInternals)
Finalizes execution with a merged internals object.
|
protected abstract T |
mergeStreamingOperatorInternals(T[] operatorInternals)
Called the merge operator to merge internals created by different streamble operators (possibly on remote
machines).
|
configure, execute, getInputPortRoles, getOutputPortRoles, getStreamableInPortIdx, getStreamableOutPortIdx, isDistributable, loadInternals, reset, saveInternals
addWarningListener, computeFinalOutputSpecs, configure, continueLoop, createInitialStreamableOperatorInternals, execute, getAvailableFlowVariables, getAvailableInputFlowVariables, getCredentialsProvider, getInHiLiteHandler, getInPortType, getInteractiveNodeView, getLogger, getLoopEndNode, getLoopStartNode, getNrInPorts, getNrOutPorts, getOutHiLiteHandler, getOutPortType, getWarningMessage, iterate, loadValidatedSettingsFrom, notifyViews, notifyWarningListeners, onDispose, peekFlowVariableDouble, peekFlowVariableInt, peekFlowVariableString, pushFlowVariableDouble, pushFlowVariableInt, pushFlowVariableString, removeWarningListener, resetAndConfigureLoopBody, saveSettingsTo, setInHiLiteHandler, setWarningMessage, stateChanged, validateSettings
public SimpleStreamableFunctionWithInternalsNodeModel(Class<T> cl)
cl
- The class of the StreamableOperatorInternals
(used for instantiation of arrays and new
instances).public SimpleStreamableFunctionWithInternalsNodeModel(Class<T> cl, PortType[] inPortTypes, PortType[] outPortTypes, int streamableInPortIdx, int streamableOutPortIdx)
cl
- The class of the StreamableOperatorInternals
(used for instantiation of arrays and new
instances).inPortTypes
- in-port types. The ports at the index streamableInPortIdx
MUST be a non-optional
BufferedDataTable
!outPortTypes
- out-port types.The ports at the index streamableOutPortIdx
MUST be a
non-optional BufferedDataTable
!streamableInPortIdx
- the index of the port that is streamablestreamableOutPortIdx
- the index of the port that is streamableprotected T createStreamingOperatorInternals()
protected abstract T mergeStreamingOperatorInternals(T[] operatorInternals)
operatorInternals
- The internals to merge.protected abstract void finishStreamableExecution(T operatorInternals)
operatorInternals
- The merged internals object.protected final ColumnRearranger createColumnRearranger(DataTableSpec spec) throws InvalidSettingsException
InvalidSettingsException
if necessary) and then return
a customized ColumnRearranger
.createColumnRearranger
in class SimpleStreamableFunctionNodeModel
spec
- The spec of the input table.InvalidSettingsException
- If the settings or the input are invalid.public StreamableFunction createStreamableOperator(PartitionInfo partitionInfo, PortObjectSpec[] inSpecs) throws InvalidSettingsException
NodeModel.execute(PortObject[], ExecutionContext)
method. Subclasses
may override it to return a new operator that follows the data handling
described by the NodeModel.getInputPortRoles()
and
NodeModel.getOutputPortRoles()
methods.
This method is called by the node executor once or multiple times depending on the input roles. If any input is distributable, the method is called multiple times (for each partition once), possibly on different (remote) clones of this NodeModel.
createStreamableOperator
in interface StreamableFunctionProducer
createStreamableOperator
in class SimpleStreamableFunctionNodeModel
partitionInfo
- The partition info describing the chunk (if
distributable).inSpecs
- The port object specs of the input ports. These are
identical to the specs that
NodeModel.configure(PortObjectSpec[])
was last called with
(also on the remote side).InvalidSettingsException
- Usually not thrown in the client but
still part of the method signature as implementations often
run the same methods as during configure. (This method is not
being called when configure fails.)public void finishStreamableExecution(StreamableOperatorInternals internals, ExecutionContext exec, PortOutput[] output) throws Exception
NodeModel.getOutputPortRoles()
.finishStreamableExecution
in class NodeModel
internals
- The merged internals of the streamable operators that
processed the data. The internals object is created by one or
multiple MergeOperator
(as created by
NodeModel.createMergeOperator()
).exec
- For progress reporting, cancelation, output creation.output
- The array of the output representations. This method must
only write to the slots that it is responsible for
(non-distributed output).Exception
- Any exception to indicate an error, including
cancelation.protected abstract ColumnRearranger createColumnRearranger(DataTableSpec spec, T emptyInternals) throws InvalidSettingsException
SimpleStreamableFunctionNodeModel.createColumnRearranger(DataTableSpec)
by an
empty internals object that is filled while processing the data.spec
- ...emptyInternals
- The empty internals. Should be passed on to the cell factory (and filled in the
AbstractCellFactory.afterProcessing()
method).InvalidSettingsException
- ...public MergeOperator createMergeOperator()
StreamableOperator
objects. This method must be
overwritten if the input is distributable but the output is not
(as it needs to prepare the final output that is then published by the
NodeModel.finishStreamableExecution(StreamableOperatorInternals,
ExecutionContext, PortOutput[])
method). It may be overwritten if
the output is distributable but some work needs to be done after
all operators have finished (e.g. setting some internals or
warning message).
The default implementation returns null
because input and
output are non distributable.
createMergeOperator
in class NodeModel
null
.
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.