The knode Command
The
knode
command manages
KNIME
nodes implemented as Cactvs scripts.
knode addparam
knode addparam khandle dialogtype name ?attribute value?..
knode addparam khandle dialogtype name attributedict
k.addparam(dialog,name,?attributedict?)
k.addparam(dialog,name,attribute=value,...)
Add a user-configurable parameter to the node definition. The first argument after the handle is the type of interface widget which should be used on the
KNIME
node configuration panel. It can be one of:
-
boolean
The parameter is a boolean value and can be set or unset via a checkbox.
-
columnselector
(or
colselector
)
The parameter is a string which corresponds to a column name of a connected data table of the associated port.
-
colorchooser
The parameter is a color specification which can be selected via a color chooser widget.
-
diropen
The parameter is the name of a directory from which data will be read. This currently does only work if the node processor and a
KNIME
workbench share the file system.
-
dirsave
The parameter is the name of a directory from where data will be written. This currently does only work if the node processor and a
KNIME
workbench share the file system.
-
double
The parameter is a floating point value which can be set via a text line.
-
doublerange
The parameter is a floating point value pair. Its lower and upper boundaries can be set via text line widgets.
-
doublespinner
The parameter is a floating point value and can be adjusted via a spinner widget.
-
fileopen
|The parameter is the name of a file opened for reading via a file selector widget. Its contents are either transported via
RPC
to the node processor, or, if it has been indicated that the node server and the
KNIME
workbench share a file system, can be directly read by the processing script.
-
filesave
The parameter is the name of a file opened for writing via a file selector widget. The file name refers to a name in the file system visible to the
KNIME
workbench and is not necessarily directly accessible by the node processor. Instead of the specified remote file name, the node server sees the name of a local temp file it should use to save its data if it has not been indicated that workbench and node server share the file system. When processing has finished, these files are automatically sent to the remote workbench client via RPC and stored there under the originally specified name. The temporary file on the server side is deleted.
-
int
The parameter is an integer which can be set via a text line.
-
intspinner
The parameter is an integer and can be adjusted via a spinner widget.
-
label
The parameter has no value and cannot be modified, but, by setting a label text attribute, it still is shown on the configuration panel as text annotation.
-
multiline
The parameter is a string which can be input via a multi-line text box.
-
multistringselector
The parameter is a list of strings which can be selected from a set of predefined strings.
-
none
The parameter is not configurable via an interface widget. It still has a (string) value which can be queried in the processing script.
-
password
The parameter is a string which can be set via a text line where the content is hidden.
-
radiobutton
The parameter is a string which can be switched between various predefined values via a radio button widget.
-
string
The parameter is a string which can be set via a text line.
-
stringselector
The parameter is a string which can be chosen from various predefined strings.
The next argument is the name of the parameter. It is used to retrieve the parameter value or other attributes via the
knode param
command. It must be unique within a node. The maximum number of parameters for a node is 128. After configuration, querying the value attribute of a parameter by means of
knode param
returns the default value. Node that you cannot explicitly configure the value attribute.
The rest of the arguments are processed after the two mandatory initial arguments have been parsed. The additional attributes which can be set for a parameter depend on its data type and dialog widget class. These are all recognized attributes:
-
addnone
If set, add a none option to the selection. This attribute is unique to the column selector widget. If this option is chosen from the interface widget, an empty table column name is reported.
-
allowempty
If set, an empty string is an allowable parameter value. The attribute is value only for
string
and
multiline
dialog widgets.
-
columntypes
(or
coltypes
)
A list of the cell data type classes which can be selected from an input table by a column selector widget. Possible values are any (the default), structure (any chemistry structure data cell type which encodes a complete structure, excludes smarts), reaction (any reaction data cell type), number (integer, long or double), boolean, int, long, double, complex, string,
xml
, bitvector, blob, image,
png
,
sdf
, mol2, sln, smiles, smarts, mol,
ctab
,
pdb
,
cml
, inchi,
cdxml
,
rxn
,
mrv
, structure1d (any structure notation without 2D or 3D coordinates, such as
SMILES
), structure2d (any structure cell type which can and is expected to store 2D coordinates), structure3d (any structure cell type which can and is expected to store 3D coordinates),
structureorstring
(any structure cell or a string cell assumed to hold structure data), simple (elementary data type, can be int, long, double, boolean or string),
simpleorstructure1d
(simple data or structure line notation) or
substructure
(any chemistry structure data cell type which can encode a substructure, includes smarts cells).
-
default
The default value which is preset and reported if the user configures nothing. The specified value must be parseable according to the parameter data type. For the
doublerange
type, the default must be a list of one or double floating point values. If only one value is given, it applies both to the lower and upper bound. For numerical values, an unspecified default is equivalent to a zero default value, and for strings an empty string.
-
description
A free-form parameter description text. It is used in the automatically written node documentation.
-
editable
A boolean flag indicating whether this value is user-editable. It only applies to string selector interface widgets. If set, the user can override the default choice set and enter a custom string instead.
-
extensions
A list of file extensions (with the dot) which is used to filter displayed file lists. Only supported for file and directory input and output dialog widgets.
-
group
The name of a group the dialog element is a member of. All dialog widgets on the same tab which share a common named group are laid out in a box with a frame. An empty string as name (the default) indicates that the dialog widget is not part of group.
-
height
The height of the dialog widgets in text lines. It only applies to
multiline
and
multistringselector
dialog widgets.
-
horizontal
If set, the dialog widget is laid out in horizontal direction from the previous widget. By default, widgets are laid out top to bottom.
-
label
A text label displayed next to the interactive widget.
-
max
The maximum allowed value. Applicable to the
integerbounded
and
doublebounded
settings types.
-
min
The minimum allowed value. Applicable to the
integerbounded
and
doublebounded
settings types.
-
name
The parameter name. Should not be set this way.
-
portassociation
The input port index or input port name a column selected is associated with. The default is 0 for the first input port.
-
property
A name of a toolkit property the parameter is related to. This is used for automatically generated node documentation.
-
required
A boolean flag whether a selection must be made by the user. Only applicable to column selectors.
-
settings
The settings Java class type used for this parameter. A suitable default settings class is automatically selected when the dialog type is set. In some cases, it may be useful to override it:
-
The
int
dialog defaults to the
integer
settings class. An alternative is
integerbounded
, which enforces minimum and maximum values.
-
The
double
dialog defaults to the
double
settings class, An alternative is
doublebounded
, which enforces minimum and maximum values.
-
The
intspinner
dialog default to the
integerbounded
settings class. An alternative is integer, which does not enforce minimum and maximum values.
-
The
doublespinner
dialog default to the
doublebounded
settings class. An alternative is double, which does not enforce minimum and maximum values.
-
step
The step size for the
intspinner
and
doublespinner
dialogs.
-
stringset
A list of strings which define choice options. This is used by
stringselector
,
multistringselector
and
radiobutton
dialogs.
-
stringset2
A list of strings which defined choice options. Currently unused, reserved for
columnfilter
dialogs which are not yet supported.
-
tab
The name of an additional tab in the configuration panel. Widgets for parameters without a tab name are placed on the primary tab. All parameters which share a common tab name are placed on an additional named tab in the order of definition. Multiple additional tab panes may be specified.
-
tablecolname
A table column name associated with the parameter. Used primarily for internal purposes. This is not the selected table column configured by a column selector widget - that is provided as value attribute like all other configuration values.
-
tooltip
A string displayed at the configuration widget if the mouse pointer hovers over it.
-
width
The widget width in characters. Applicable to int,
double
,
intspinner
,
doublespinner
,
string
,
password
and
multiline
widgets.
The command returns the current number of parameters on the node.
knode addport
knode addport khandle direction ?name? ?attribute value?...
knode addport khandle direction name attributedict
k.addport(direction,?name?,?attributedict?)
Add a port to the node definition. The first argument is either input or output and defines the port direction. The second argument it the port name. If the name is omitted, a name following the schema
input0...n
or
output0..n
is automatically generated. Without additional attributes, the port class is datatable. The maximum number of ports for a node is 16.
Additional attributes may me specified as attribute/value pairs or as a dictionary. The following attributes are recognized:
-
class
(or
type
)
The port class. It can be either
datatable
(the default), network/graph or image. Other
KNIME
port types are currently unsupported. If this attribute is set, it should be the first in the attribute list because it influences the applicability or interpretation of other attributes.
-
description
A free-form test describing the role of the port. This is used for the automatically written node documentation which can be viewed for connected node in a
KNIME
workspace.
-
imagename
The name of the port image object. It is of little consequence for toolkit data processing, but is shown when the data ports of a connected node are viewed in the
KNIME
node menu. This attribute is only applicable to image ports.
-
mimetype
The mime type of the port data encoding. It is only used for image ports and identifies the image format. Typical values are
image/png
,
image/gif
or
image/svg+xml
. When result image data is set for a port, its encoding must match the pre-configured mime type.
-
optional
If set,
KNIME
workbench connections to this (input) port are optional. The node can be executed from the workbench with or without active connections to the port. When a table or network port object handle is queried for an unconnected optional port (see
knode port
command), an empty string is reported instead of the object handle.
-
networkname
The name of the port network object. It is of little consequence for toolkit data processing, but is shown when the data ports of a connected node are viewed in the
KNIME
node menu. This attribute is only applicable to graph ports, and it is not the same as a network object handle.
-
streaming
A boolean flag indicating if this port is streaming. The attribute has an effect only for data table ports. If it is not set (the default), all input table data is transmitted from a connected
KNIME
workspace before execution, and all result table data is sent after the execution has finished. In this model, the full input table content is immediately available, and previously added output table rows can be inspected. The disadvantage of this model is that all cell data needs to be kept in memory at the same time.
With streaming data table ports, only a partial input row block has been sent when execution starts, and further data transfer overlaps with processing. Execution scripts usually remove input table rows from the top of the table (see
table pop
or
table poploop
commands) to keep it from growing. Determining whether all table data has been sent is possible by checking the eod table attribute. The same flag is internally tested by the standard table row loop commands.
Rows added to streaming output tables are regularly sent back to the
KNIME
workspace and removed thereafter. There is no guarantee that a previously added output row can be revisited before it is sent and disappears. Execution scripts must be careful to add each output row and associated row information with a single, automatically synchronized statement. The advantage of streaming ports is that only a small part of the full table data needs to be kept in memory at any time. They can also be faster to run because transfer and computation are performed in concurrent threads. It is possible to mix streaming and non-streaming ports in a single node in arbitrary combinations.
-
tablename
The name of the port data table. It is of little consequence for toolkit data processing, but is shown when the data ports of a connected node are viewed in the
KNIME
node menu. This attribute is only applicable to data table ports and it is not the same as a table object handle.
knode bglisten
knode bglisten ?port?...
Knode.Bglisten(?port?,...)
Add one or more background
RPC
communication listener threads. If no port is specified, a lister on the standard port is configured. It can be examined and set via control variable
::cactvs(knimenode_default_port)
, its default is 16570.
An interpreter with an active background listener can receive and process
RPC
commands, for example from a
KNIME
workbench.
It is currently not possible to process
Python
node scripts in background threads due to
Python
multi-threading limitations.
The command has no return value.
knode bgunlisten
knode bgunlisten ?port?...
Knode.Bgunlisten(?port?,...)
Cancel listener threads active on specific ports. If no port is specified the standard port is assumed. The standard port can be examined and set via control variable
::cactvs(knimenode_default_port)
, its default is 16570.
Trying to cancel non-existing listener threads is silently ignored. If a thread is currently processing a
RPC
request, the cancellation happens after the current request has been served.
It is currently not possible to process
Python
node scripts in background threads due to
Python
multi-threading limitations.
The command has no return value.
knode clearparameters
knode clearparameters khandle
k.clearparameters()
Delete all currently defined parameters from the node.
The command can be shorted to
knode clearparams
.
The return value is the original node handle or reference.
knode clearports
knode clearports khandle
k.clearports()
Delete all currently defined ports from the node.
The return value is the original node handle or reference.
knode compile
knode compile khandle ?jarfile?
k.compile(?jarfile=?)
Compile the node definition into a
KNIME
workspace node. The result is a
JAR
file which can be copied into the drop-in directory of a local
KNIME
installation. By default, the name of the
JAR
file is constructed from the vendor domain, node name (or explicit Java class name, if set) and version, but it is also possible to request a custom
JAR
file name. A typical auto-generated
JAR
file name looks like com.xemistry.ExcelSaver_1.1.jar. After a
KNIME
program restart, the new node automatically shows up in the node browser.
The
JAR
file contains
RPC
interface code for communication with a node execution server, a normal-looking
KNIME
workspace node with ports, a configuration panel automatically assembled from the defined configuration parameters , auto-generated node documentation, node browser location and icon data, and the node definition code. When a node in a
KNIME
workspace connects to a node server, the node definition is transmitted and the node instantiated on the server. This node is then executed in the configuration and execution phases in response to normal
KNIME
workflow actions. Parameter configuration information is extracted from the configuration panel and sent in the configuration phase, together with column definition information of data cell ports. Port contents are either sent before execution, or, in streaming mode, parallel to execution. Likewise, result data from the node server is sent back either when the node execution has finished, or streamed in parallel to its execution.
Within the scripted node environment, data table port data appear as toolkit tables, graph port data as port objects, and image data as byte blob.
KNIME
can be finicky about Java compiler versions. It may be necessary to configure the
javac
attribute so that the right compiler release is picked up.
knode configure
knode configure khandle ?paramname paramvalue?...
knode configure khandle paramdict
k.configure(?paramname,paramvalue?,...)
k.configure(paramdict)
Invoke the configuration script of the node, optionally with a custom set of configuration options. The value attribute of the named parameters are persistently changed to the new values, if this is allowable with respect to parameter type, minimum/maximum values, etc. If the setting of a parameter fails, an error is reported.
This command is typically used during node development, without a
KNIME
workspace connection. If a node is connected to a
KNIME
workspace, its configuration procedure is automatically invoked at the proper times.
Note that this command does not set input port data, which is at least partially defined when connected to a
KNIME
workspace via the output ports of connected nodes. During debugging outside of
KNIME
, suitable input port data for processing must be provided by script commands which either set the data explicitly, (see
knode port
command) or by setting input port filenames. In the latter case, their content is automatically loaded and transfered to the input ports before the configuration code is run.
If the configuration succeeds, the node is ready for execution by
knode exec
in debug mode.
The return value of the command is a list of the table handles or references, network handles or references and image bytes on the input ports in port index order.
knode config
is a command alias.
knode create
knode create ?attribute value?...
knode create ?attributedict?
Knode(?attribute,value?,...)
Knode(attributedict)
Knode.Create(?attribute,value?,...)
Knode.Create(attributedict)
Create a new
KNIME
node object. Without any arguments an unconfigured default object is created. Additional arguments can be used to set attributes. The recognized attributes are the same as for the
knode set
command.
The return value is the handle or reference of the new
KNIME
node object.
knode delete
knode delete ?khandle?...
knode delete all
k.delete()
Knode.Delete(?khandle/kref?,...)
Knode.Delete(“all”)
Delete specific or all
KNIME
node objects from the toolkit interpreter instance. The return value is the number of successfully deleted
KNIME
node objects.
In case the node is actively connected with a
KNIME
workspace, the connection is cut and a network error is reported in the workspace. Generally, nodes actively connected to a workspace should only be deleted from there, which is performed by
RPC
communication from the workspace to the toolkit interpreter. This command is still useful for example in node development and compilation environments.
knode execute
knode execute khandle
k.execute()
Execute a
KNIME
node by invoking its execution procedure. It is assumed that the node has been successfully configured (see
knode configure
command).
This command is typically used during node development, without a
KNIME
workspace connection. If a node is connected to a
KNIME
workspace, its execution procedure is automatically invoked at the proper times.
If the execution succeeds, output port result data may be accessed by
knode port
commands.
The return value of the command is a list of the table handles, network handles and image bytes on all the output ports in port index order.
The command may be abbreviate to
knode exec
.
knode exists
knode exists khandle
k.exists()
Knode.Exists(handle/ref)
Check whether a node handle is valid.
knode get
knode get khandle attribute
k.get(attribute)
k.attribute
k[attribute]
Retrieve the current value of a node object attribute. All attributes which can be set can also be read (see
knode set
command). In addition, there are a couple of read-only attributes:
-
errorflag
A flag indicating the status of the last invocation of the configuration or execution procedure of this node. The flag is reset before any of these functions are called.
-
errormessage
The error message reported by the last invocation of the configuration or execution procedure of this node. The message is reset before any of these functions are called, and it is empty if there was no error.
-
inputportcount
The number of input ports on this node.
-
inputports
A list of the names of all input ports, in port index order.
-
inputtables
A list of the table handles or references of all input ports which are table ports, in port index order. If a port is not a data table port, or its table has not yet been configured, an empty string is reported for that port.
-
inrpc
A flag indicating weather the current commands are executed in the context of an
RPC
operation, or by a locally run script or interactive commands.
-
issafe
A flag indicating whether the current interpreter is safe (restricted) or not. By default, node interpreters are restricted node-specific slaves of the main interpreter.
-
handle
The handle of the current node. This is useful in case the node is addressed via its instance
UUID
.
-
lastrun
The time stamp of the last time the execution function of the node was called.
-
lastruntime
The number of seconds spent running the execution function of the node the last time.
-
log
A list of all log messages accumulated in the last run. Every list element is a nested list with the log level and the log message text.
-
nodetype
The general type of the node (
source
,
sink
,
manipulator
or
other
).
-
outputportcount
The number of output ports on this node.
-
outputports
A list of the names of all output ports, in port index order.
-
outputtables
A list of the table handles or references of all output ports which are table ports, in port index order. If a port is not a data table port, or its table has not yet been configured, an empty string is reported for that port.
-
parameters
A nested list of the setting of all node configuration parameters. Every list element is a dictionary with all applicable attributes of a parameter. Its exact content is dependent on the dialog widget configured for the parameter. Dictionary entries supported for all parameter types are
description, dialog, label, group, horizontal, name, property, settings, tab, tooltip, tablecolname
and
value
. Other dialog-dependent entries are
addnone, allowempty, columntypes, default, editable, extensions, height, min, max, portassociation, required, step, stringset
and
width
.
-
params
A short alias for parameters.
-
ports
A nest list with the most relevant general port information. Every list element contains the port name, its direction (
input
or
output
), its port class (
datatable
,
image
or
network
), the port description string, the streaming flag, the optional flag, the
configreset
flag, the port table name, and the port table handle, if it is a data table port and it is already configured.
-
scriptlanguage
The language used in the configuration and execution script blocks. It is either
Tcl
or
Python
. Its type is implicitly defined by which commands the script source is set.
-
tmpdir
The temporary directory to be used by this node. Depending on the server configuration, this can be either the normal system directory, or a specially protected node-specific directory. Nodes should not assume that they have access to the system tmp directory, or any other file-system location, except this location.
-
totalprocessedinrows
The total number of rows in input tables this node instance has so far received from a connected
KNIME
workbench..
-
totalprocessedoutrows
The total number of output table rows this node instance has so far sent to a connected
KNIME
workbench.
-
totalruntime
The total execution time this node instance has accumulated so far.
knode list
knode list ?pattern?
Knode.List(?pattern=?)
Return a list of all currently existing
KNIME
object handles. If a filter pattern is specified, only handles matching it are listed. The pattern syntax is the same as in the standard
Tcl
command
string match
.
knode listen
knode listen ?port?
Knode.Listen(?port=?)
Start a foreground
RPC
listener. If no port is specified, the standard port is assumed. It can be examined and set via control variable
::cactvs(knimenode_default_port)
, the default is 16570.
This command does not return except on error or the listener loop has been canceled by outside actions.
knode log
knode log khandle ?level? message
k.log(?level=?,?message=?)
k.log(message)
Add a log message to the node state. The level may be one of debug, info, warning, error or fatal. The default level is info. The message text is a free-form string. If the message is empty, no actual log entry is written.
Log messages are transmitted to a connected
KNIME
workspace and show up in the console window.
The command returns the original node handle or reference.
knode parameter
knode parameter khandle parametername ?attribute?
k.parameter(name=,?attribute=?)
Retrieve an attribute or the current value of a node configuration parameter. Within the context of a live
KNIME
workbench connection, these are automatically extracted from the configuration panel settings and available both in the configuration and execution procedures.
The current parameter values (but not other attributes) can also be accessed from within a node configuration or execution script as global array variable :
:params
.
If no attribute is specified, the parameter value is retrieved.
Parameters may be accessed via the parameter name or the 0-based parameter index.
knode getparam
,
knode getparameter
and
knode param
are command aliases.
The following attributes are recognized:
-
addnone
A boolean flag indicating whether the parameter dialog contains an additional none option.
-
allowempty
A boolean flag indicating whether the parameter dialog field may be left unfilled.
-
columntypes
(or
coltypes
)
A list of native
KNIME
table column types a column selector may be applied to.
-
default
The default value of this parameter.
-
description
A free-form descriptive string.
-
dialog
The type of dialog widget associated with this parameter in the configuration panel of the Java interface class.
-
editable
A boolean flag indicating whether the value is editable in the configuration panel.
-
extensions
A list of allowed or display-filtered file extensions for file I/O selector widgets.
-
filecontent
The file bytes from a file input selector widget. For this widget, the value attribute returns the file name. If no file was specified, an empty result is returned.
-
filecontentlen
The length of the file content from a file input selector widget in bytes. If no input file was specified, or it could not be opened, the attribute value is minus one. This allows distinction between empty, but readable input files and unspecified or unreadable files.
-
group
The name of the widget group this parameter is part of, or an empty string if it is not. Widget groups are rendered within a frame in the
KNIME
configuration panel.
-
horizontal
A boolean flag. If set, the layout of the dialog widget is performed in horizontal and not vertical direction.
-
index
The 0-based parameter index value.
-
label
The text label used to name the widget in the configuration panel.
-
max
The maximum value of the parameter. Only defined for bounded integer and double settings.
-
min
The minimum value of the parameter. Only defined for bounded integer and double settings.
-
name
The parameter name. Useful if the parameter was identified via its index.
-
portassociation
(or port)
For column selector widgets, the input port index this selector applies to.
-
property
The name of a toolkit property this parameter is associated with. If there is no association, this is an empty string. This attribute is used in the auto-generated node documentation.
-
required
A boolean flag indicating whether this parameter must have been set by the user.
-
settings
The enumerated class name of the settings object associated with the parameter. This implicitly defines the datatype of the parameter and is interdependent with the associated dialog type.
-
stringset
A list of strings, for example defining possible values of a string selector widget.
-
stringset2
A second list of strings. Used only in column filter dialogs.
-
tab
The name of an additional tab in the configuration panel the widget for this parameter is placed on. Parameters on the default tab report an empty tab name.
-
tablecolname
(or
colname
)
The name of a table column selected by a column selector widget.
-
tooltip
The tooltip string displayed by the KNIME configuration panel if the user hovers with the mouse over a configuration widget.
-
value
By far the most important attribute - this is the currently configured value of the parameter.
knode port
knode port khandle portname attribute
knode port khandle portname table ?tablehandle|#new? ?isowner?
knode port khandle portname imageblob ?imagebytes?
knode port khandle portname imagefile ?filename?
knode port khandle portname network ?networkhandle|#new? ?isowner?
knode port khandle portname expectedrows ?count?
k.port(name=,attribute=,?value=?,?isowner=?)
Retrieve information about a a specific port, or set it. Ports can be identified by their name, or by their 0-based port index. Some port attributes can be modified. In this case, one or two additional parameters for the new attribute value follow the attribute name argument.
The following attributes are recognized:
-
buffersize
The buffer size of the port.
-
class
The port class (
datatable
,
image
or
network
).
-
configreset
If set to 0, the output port table configuration is not reset before the configuration procedure. By default, all tables associated with output ports are deleted before the function is called.
-
description
Free-format description string.
-
direction
Port direction (input or output).
-
expectedrows
The number of table rows this port is expected to receive until end-of-data. For input ports, this information is transmitted via
RPC
from the
KNIME
workbench in case the size of the input table is known. The value can be set, typically from the configuration procedure, and this influences for example automatic node execution progress reporting in some progress reporting modes.
-
filename
Specify the name of a file which contains data to be loaded into an input port, or the name of a file to which port contents should be written after execution for output ports. This is either a table data file (for data table ports, usually in native
KNIME
table format), a network data file (for network ports, usually in native
KNIME
table format), or a image for for image ports. The purpose of this attribute is to facilitate node debugging outside of
KNIME
. Input ports are loaded when the
node configure
command is executed, but not when a node is configured from within a server listener thread. Likewise, port contents are written when a
node exec
command has successfully completed execution, but again not when the execution was performed in a server thread.
-
imageblob
On retrieval, this returns the currently set image bytes for the port, which is defined only for image ports. This attribute can be set on image ports with data bytes representing a
GIF
,
PNG
or
SVG
image. The image content is transmitted back to the
KNIME
workspace when the node execution has finished.
-
imagefile
On retrieval, this returns the name of a temporary file filled with the currently configured image bytes for this port, which is defined only for image ports. This attribute can be set on image ports with the name of a file storing a
GIF
,
PNG
or
SVG
image. The file bytes are read and stored as image bytes. The name of the input file is not remembered. The image content is transmitted back to the
KNIME
workspace when the node execution has finished
-
imagename
The name (not handle or reference) of the image associated with this port, as shown in the port menu on nodes in a
KNIME
workspace.
-
index
The port index. The port index is assigned in the order of port definitions (see
knode addport
command).
-
mimetype
The mime type associated with the port. This is useful only for image ports.
-
name
The port name.
-
optional
A boolean flag indicating whether this port may remain unconnected in the
KNIME
workspace. In configuration procedures, unconnected optional input ports do not possess an associated automatically set up table or network object, or image bytes.
-
network
On retrieval, return the handle or reference of the network object associated with the port, or an empty string if no such network exists. If the port is a non-optional or output network port, and no network object has yet been configured, retrieval results in implicit creation of an empty network object and its association with the port. This attribute may be set for network ports. The argument is either the handle of an existing network object, an empty (also
None
for
Python
) string (which destroys any existing network on the port) or the magical string #new, which creates a new empty network and associates it with the port. After association, the network life-cycle is managed by the node and cannot be deleted via its handle. When the node is destroyed, or the network replaced, it is automatically deleted, except when the optional
isowner
flag is also specified when the port network is set. With this flag set, the script writer remains responsible to delete the network when it is no longer needed, but this can be done only after the node association has been broken.
-
networkname
The name (not handle or reference) of the network associated with this port, as shown in the port menu on nodes in a
KNIME
workspace.
-
processedrows
The number of rows which have been received from or sent to a connected KNIME workspace, via this port during the current node execution run.
-
streaming
A boolean flag indicating that transfer of input table rows, or sending of result table rows, should proceed in parallel with node execution for this port. If the flag is not set, input tables are fully filled when node execution begins, and output tables are only sent after node execution finishes. Otherwise, these operations overlap. If streaming is active, specific node execution code patterns must be followed. Streaming can only be used on data table ports.
-
table
On retrieval, return the handle or reference of the table object associated with the port, or an empty string if no such table exists. If the port is a non-optional or output data table port, and no table object has yet been configured, retrieval results in implicit creation of an empty table object and its association with the port. This attribute may only be set for data table ports. The argument is either the handle of an existing table object, an empty (or
None
for
Python
) string (which destroys or dissociates any existing table on the port) or the magical string #new, which creates a new empty table and associates it with the port. After association, the table life-cycle is managed by the node and cannot be deleted via its handle. When the node is destroyed, or the table replaced, it is automatically deleted, except when the optional
isowner
flag is also specified when the port table is set. With this flag set, the script writer remains responsible to delete the table when it is no longer needed, but this can be done only after the node association has been broken.
-
tablename
The name (not handle) of the table associated with this port, as shown in the port menu on nodes in a
KNIME
workspace.
knode read
knode read filename
Knode.Read(filename)
Create a node by reading an
XML
-based node definition file. The default node file suffix is .knd (
KNIME
node definition), but this is not enforced.
The return value is the handle or reference of the new node.
knode readblob
knode readblob blobdata
Knode.Readblob(blobdata)
Create a new by reading an
XML
-based node definition file directly from string data.
The return value is the handle or reference of the new node.
knode reset
knode reset khandle
k.reset()
Reset the node so that its state is the same as after a
knode create
command. All result data, port and parameter definitions as well as accumulated log messages are deleted and the basic node attributes are reset to default values.
The command returns the original node handle or reference.
knode resetlog
knode resetlog khandle
k.resetlog()
Reset the accumulated log information of the node. When connected to a
KNIME
workspace, log messages which have been transferred to the workspace are automatically deleted. Also, any new call to the node configuration or execution functions resets the log.
The command returns the original node handle or reference.
knode set
knode set khandle ?attribute value?...
knode set khandle dict
k.set(?attribute,value?,...)
k.set(dict)
k.attribute = value
k[attribute] = value
Set zero or more node object attributes. The recognized attributes are:
-
adaptercells
A boolean flag indicating whether the node should use the new multi-encoding Adapter cell
KNIME
table cell classes for storing structure data. If set, structure data cells sent back to a
KNIME
workspace will be automatically backed up by a native toolkit version of the structure, which makes decoding faster and retains computed structure data directly on the structure object. If a backing native toolkit encoding is present when a cell with structure data is decoded, it is used preferably over other encodings such as
SMILES
or
MDL
Molfile which might also be present. It is recommended to set this attribute if your
KNIME
installation is sufficiently recent.
-
address_city
The city part of the author contact address.
-
address_country
The country part of the author contact address, following the ISO3166 standard.
-
address_state
The state part of the author contact address. Empty if not applicable.
-
address_street
The street address part of the author contact address. Includes floor, house number, etc.
-
address_zip
The
ZIP
code or other applicable postal code of the author contact address.
-
affiliation
The institution the author of the node works for.
-
affiliationduns
The
DUNS
registration ID of the affiliated institution. This is primarily useful for US government projects.
-
affiliationurl
The
URL
of the affiliated institution.
-
author
The author of the node. This is a free-form string.
-
authorurl
A
URL
with information on the author, or an empty string if unset.
-
beta
A boolean flag indicating beta status of the node. If set, the node character is indicated in the auto-generated node documentation which can be viewed within a
KNIME
workspace.
-
cancelrequest
A boolean flag. If set, it indicates the desired to cancel the currently executing
RPC
command on the node. This is primarily useful for debugging and not used in normal programming. The cancellation request flag is automatically reset if the cancellation has been performed.
-
category
A category string to be used if the node definition is stored in a repository. The default category is
CactvsNodes
. This is the section under which in a
KNIME
workbench the node is listed after installation.
-
categorydescription
A free-form text describing the category defined above.
-
categoryiconfile
A
PNG
icon file associated with the node category. It should be size 16x16. The icon is displayed in the node browser of
KNIME
workbenches with the category name. The default icon is a small green flowering cactus.
-
classuuid
The base class
UUID
of this node definition.
-
comment
A free-form text comment.
-
configproc
The name of the
Tcl
procedure which handles the node configuration phase as initiated from a
KNIME
workspace. The function is passed the handle of the node to configure as a single argument. The most important task of a
config
procedure is to set the columns of node output tables, usually after inspecting the settings of configuration options and the column definitions of connected input tables. The option and input table column definition data is available at configuration time, but not input table cell (or other input port) content. The default name for the configuration procedure is
config
.
-
configscript
A body of
Tcl
code containing the procedures handling node configuration. Often this is just a single procedure. The name of one of the procedures defined in this block must match the value of the
configproc
attribute. This procedure is called as entry point. Other procedures defined in the block are visible, but otherwise the configuration script executes in a restricted slave interpreter which is instantiated on a per-node basis.
tclconfigscript
is an alias.
-
configscriptfile
The name of a file which contains the
Tcl
source code of the configuration section. The file content is read and processed like the more commonly used in-line
configscript
attribute.
-
configtrace
A boolean flag which, if set, requests command tracing of the configuration procedure. This applies only to
Tcl
code. The trace output is visible only on a local interpreter instance, not from a
KNIME
workbench.
-
date
This attribute stores the date of the node definition compilation. It is used for information purposes only. If a new node is compiled, it is initialized to the current date.
-
deadmantimeout
Set a node-specific deadman timeout. The attribute is an integer with milliseconds as unit. A non-zero value set here overrides a globally set general
KNIME
node deadman timeout. If the execution of the configuration or execution script on this node exceeds the timeout, the application server process is summarily killed. This feature is primarily used to protect node servers from scripts maliciously hogging resources. A killed node server process results in errors on all connected
KNIME
workspace clients, but nodes linked to a server can automatically re-connect if the server process is re-started (which is done automatically in a standard node server set-up), and node result data already transferred to a workspace is not compromised.
-
defaultlanguage
The default language for automatically generated set-up and test scripts in the absence of other indicators, such as suffixes in the names of output files. It can be either
Tcl
or
Python
.
-
deprecated
A boolean flag indicating deprecated status of the node. If set, the node character is indicated in the auto-generated node documentation which can be viewed within a
KNIME
workspace.
-
doi
A digital object identifier for the node, if defined.
-
editurl
The default node designer
URL
to export the node definition to via the configuration panel button of a node, if the node was compiled with an open definition. The default is
https://xemistry.com/nodedesigner
.
-
email
The email address of the creator of the node, useful in case a definition file is distributed and anybody has questions.
-
execproc
The name of the
Tcl
procedure which handles the node execution phase as initiated from a
KNIME
workspace. The function is passed the handle of the node to configure as a single argument. The function is called after a successful configuration phase. Usually, all input and output ports have already been set up, and at least an initial data portion is already present in the input tables or other input port objects.The execution procedure then reads the input table rows or other input data and, usually depending on configuration panel settings, appends output table rows. In case of streaming input tables, new input data continues to arrive while the procedure executes, and input rows are usually popped from the input tables during processing to avoid accumulating large amounts of table data. For streaming output tables, result rows which have been transmitted to a connected workspace are automatically removed..The default name for the execution procedure is
exec
.
-
execscript
A body of
Tcl
code containing the procedures handling node execution. Often this is just a single procedure. The name of one of the procedures defined in this block must match the value of the
execproc
attribute. This procedure is called as entry point. Other procedures defined in the block are visible, but otherwise the execution script executes in a restricted slave interpreter which is instantiated on a per-node basis.
tclexecscript
is an alias.
-
execscriptfile
The name of a file which contains the
Tcl
source code of the execution section. The file content is read and processed like the more commonly used in-line
execscript
attribute.
-
exectrace
A boolean flag which, if set, requests command tracing of the execution procedure. This applies only to
Tcl
code. The trace output is visible only on a local interpreter instance, not from a
KNIME
workbench.
-
expertflag
A boolean flag indicating expert status of the node. If set, the node character is indicated in the auto-generated node documentation which can be viewed within a
KNIME
workspace.
-
fork
A boolean flag indicating that the node should be configured and executed in a forked node server instance, which automatically terminates when execution is complete. For
Python
-based nodes, this is automatically enforced because of the severe multi-threading limit of
Python
interpreters and their dangerous lack of intra-interpreter isolation.
-
fulldescription
A long description text. It is displayed in the auto-generated node documentation which can be viewed in a
KNIME
workbench.
-
keywords
A free-form list of keywords associated with the node.
-
id
The official registration ID of the node.
regid
is an alias.
-
infourl
A
URL
with information on the node, or an empty string if unset.
-
instanceuuid
The
UUID
of this node instance. It is usually not recommended to set or change this by script commands, since it is essential for
RPC
communication.
-
javac
The path to the Java compiler to use for the compilation of the Java code auto-generated for the
KNIME
-side node interface object. If it is not set, an attempt is made to find a Java compiler in the normal executable path. Note that
KNIME
can be finicky about Java compiler version mismatch. Even if you find a
javac
by normal path search, it may not be the right one among multiple installation.
-
keepjavasource
If set, the Java source automatically generated for the
KNIME
-side node interface class is retained after compilation. This is a debug option.
-
knimeplugindir
The standard directory for user-defined nodes in the local
KNIME
installation. If is is set, newly compiled nodes are automatically copied to this location.
-
lenient
A boolean attribute. If it is set, the applicability of parameter attributes with respect to their dialog type is not checked. For normal scripting the flag should not be used, but it is helpful when setting up automatic processing of node definitions.
-
license
The license class associated with this node. Setting the license to a standard type updates the associated
URL
with a standard location.
-
licenseurl
A
URL
with details about the node license.
-
listcells
If set, this node may use list cells for data communication with a
KNIME
workbench, for example for array- and compound-class property data. List cells are only available in more recent
KNIME
versions.
-
literature
A free-form literature reference.
-
localfs
If set, this indicates that the
KNIME
workbench and the node server share a common file system. This means that file data from configuration panels or data cells does not need to be transferred via the
RPC
connection. Instead, file names can be sent, which makes processing more efficient for larger files.
-
mintoolkitversion
A version number in 1.2.3.4 or shortened notation indicating the minimum toolkit version of a node server which is able to execute this node, for example because the node uses features or properties which were introduced only in recent toolkit versions. If an older node server receives node code with a higher version requirement, execution is denied.
-
msglogfile
The name of a file which captures all messages generated by a node. Messages also appear in the console of a connected
KNIME
workbench. On servers, custom message file logs are usually not allowed, so this is primarily a debug feature for local node development. Magic file names stdout and stderr may be used, and an empty log file name disables per-node message logging. This attribute cannot be queried.
-
name
This is the name of the node. If this is changed, the node class root name and default JAR file name are also implicitly changed.
-
naptime
The number of microseconds to sleep in transfer threads if no data is available to be sent or received. The default are 25000 microseconds. A lower value decreases processor load, a higher value make nodes appear less responsive.
-
nodeclassroot
The root Java class name of the
KNIME
workbench interface object. This is usually not set directly, but auto-derived from the node name.
-
nodeiconfile
A file which contains a custom node icon as
PNG
file. The standard icon size are 16x16 pixels. This icon is displayed in the node browser of a
KNIME
workbench. The default icon is a small green flowering cactus.
-
orcid
The ORCID code of the author of the node (see www.orcid.org).
-
path
The menu path associated with the node.
-
phone
A contact phone number of the author.
-
pluginjarfile
The file name of the compiled Java node interface class for use in a
KNIME
installation. Usually, this is not set ad the
JAR
file name is auto-derived from the node name.
-
progressmessage
A free-form string which is used as component of node execution progress messages.
-
progressmode
The method to report node execution progress to a connected
KNIME
workbench. The default is none, and no progress updates are sent. Other supported modes are:
-
scripted - the progress indicator is updated from within the execution script.
-
portrows
- the progress value is the percentage of input and output rows of all table ports which have been read or written vs. the expected total row count.
-
porteods
- the progress value is the portion of all ports which have reached end-of-data status.
-
inportrows
- like
portrows
, but computed only for input table ports.
-
inporteods
- like
porteods
, but computed only for input ports.
-
outportrows
- like
portrows
, but computed only for output table ports.
-
outporteods
- like
porteods
, but computed only for output ports.
-
inportrows0
- like
inportrows
, but computed only for input port 0.
Modes
inportrows[0-2]
,
inporteods[0-2],
outportrows[0-2]
and
outporteods[0-2]
follow the same schema.
-
property
The name of a single toolkit chemical data-related property which is computed by this node. This information is used for the auto-generation of node documentation. Setting this attribute appends a property to the node property register. It does not overwrite previous entries. The maximum size of the property register is 32 entries. Multiple properties can be set at once, or the register reset, with the properties attribute. This attribute cannot be queried.
-
properties
A list of toolkit chemical data-related properties which are computed by this node. This information is used for the auto-generation of node documentation. The maximum size of the property register is 32 entries.
-
pyconfigscript
Essentially the same as
tclconfigscript/configscript
, except that the configuration procedure block is expected to be a
Python
function collection, not a
Tcl
procedure block. Note that the use of configuration or execution scripts written in
Python
is currently limited, insecure and burdened with mandatory fork overhead compared to the
Tcl
counterpart.
-
pyconfigscriptfile
Essentially the same as
tclconfigscriptfile/configscriptfile
, except that the configuration source code file is expected to be a
Python
function collection, not a
Tcl
procedure source file. Note that the use of configuration or execution scripts written in
Python
is currently limited, insecure and burdened with mandatory fork overhead compared to the
Tcl
counterpart.
-
pyexecscript
Essentially the same as
tclexecscript/execscript
, except that the configuration procedure block is expected to be a
Python
function collection, not a
Tcl
procedure block. Note that the use of configuration or execution scripts written in
Python
is currently limited, insecure and burdened with mandatory fork overhead compared to the
Tcl
counterpart.
-
pyexecscriptfile
Essentially the same as
tclexecscriptfile/execscriptfile
, except that the execution source code file is expected to be a
Python
function collection, not a
Tcl
procedure source file. Note that the use of configuration or execution scripts written in
Python
is currently limited, insecure and burdened with mandatory fork overhead compared to the
Tcl
counterpart.
-
pyscript
This attribute allows the definition of both the configure script and the execution script in one blob of
Python
source code. See
pyconfigscript
and
pyexecscript
attributes.
-
pyscriptfile
This attribute allows the import of both the configure script and the execution script from one file with
Python
source code. See
pyconfigscriptfile
and
pyexecscriptfile
attributes
.
-
renderproperty
The name of a single toolkit chemical rendering-related property which is computed by this node. This information is used for the auto-generation of node documentation. Setting this attribute appends a property to the node property register. It does not overwrite previous entries. The maximum size of the property register is 32 entries. Multiple properties can be set at once, or the register reset, with the
renderproperties
attribute. This attribute cannot be queried.
-
renderproperties
A list of toolkit chemical rendering-related properties which are computed by this node. This information is used for the auto-generation of node documentation. The maximum size of the property register is 32 entries.
-
rowblocksize
The number of table data rows which are transferred within one
RPC
message block, if that much data is available. The default is 50. Changing this parameter is not advised under normal circumstances.
-
rpcflags
A set of flags influencing the
RPC
communication between node server and
KNIME
workbench. Bit positions of this flag are usually set by dedicated script commands. Recognized flags include none,
localfs
,
secure
and
structureexport
.
-
rpchost
The name of the host this node communicates with. This is usually not set manually but transmitted as part of the credentials of a
KNIME
workbench node interface object.
-
rpclogfile
The name of a file which logs debug information about the
RPC
communication with a
KNIME
workbench. Magic file name stdout and stderr are supported, and an empty filename (or
None
for
Python
) disables
RPC
logging.
RPC
logging on remote servers is usually disabled, so this is primarily a debug feature for local node development.
-
rpcpassword
The
RPC
password. This is usually not set manually but transmitted as part of the credentials of a
KNIME
workbench node interface object.
-
rpcport
The port for
RPC
communication. This is usually not set manually but transmitted as part of the credentials of a
KNIME
workbench node interface object.
-
rpcuser
The remote user of this node. This is usually not set manually but transmitted as part of the credentials of a
KNIME
workbench node interface object.
-
script
This attribute allows the definition of both the configure script and the execution script in a single blob of
Tcl
source code. See
configscript
and
execscript
attributes.
-
scriptfile
This attribute allows the import of both the configure script and the execution script from a single file with
Tcl
source code. See
configscriptfile
and
execscriptfile
attributes
.
-
shortdescription
A free-form short node description string. It is used as part of the auto-generated node documentation which can be viewed in a
KNIME
workbench.
-
showxmlsource
If set, the compiled Java interface node contains an extra tab in the configuration panel which contains the source of the node definition in
XML
format (see
knode write
command). This text can be
copied&pasted
for easy sharing of the node source code and further third-party modification of the node.
-
structureexport
This flag can be set to values never,
parameterdependent
and
always
. If set to anything but never, the node may, or always does, send (potentially sensitive) structure information to 3rd party sites, for example for the lookup of structure data from Internet sites. If that is the case, the user must approve this operation by checking an automatically provided checkbox in the node configuration panel on the
KNIME
workbench. Otherwise, the node will not export structure data and fail.
-
tclconfigscript
See
configscript
, this is an alias.
-
tclconfigscriptfile
See
configscriptfile
, this is an alias.
-
tclexecscript
See
execscript
, this is an alias.
-
tclexecscriptfile
See
execscriptfile
, this is an alias.
-
tclscript
See
script
, this is an alias.
-
tclscriptfile
See
scriptfile
, this is an alias.
-
unrestricted
If this flag is set, the node requires an unrestricted
Tcl
interpreter for execution. with file system and network access. Whether a server honors this request, is a server configuration issue. Public servers will generally refuse execution of such nodes because this is a severe security risk.
Python
does not support restricted interpreters and such nodes are therefore always considered unrestricted (and not executed on public servers).
-
vendordomain
The domain of the vendor or developer of the node. This is used as part of the Java class configuration. The default is xemistry.com.
-
version
The version of the node. This is a string in a 1.2.3 (or shortened) style. If the version changes, the default
JAR
file name is automatically updated.
-
versionuuid
The version
UUID
associated with this node version.
-
workdir
The name of a directory for temporary files assembled and compiled during the assembly of a Java
JAR
file. The directory is created if it is not yet present. It must be writable. By default, a random directory in the system-dependent temporary files directory is created and automatically deleted after
JAR
file generation. If a custom work directory is used, it is not auto-deleted, but internal cleanup still proceeds except in case Java sources are retained (see
keepjavasource
attribute).
knode subcommands
knode subcommands
dir(Knode)
List all subcommands of the
knode
command.
knode write
knode write khandle ?filename?
k.write(?filename=?)
Write the node definition to an
XML
-based file which is suitable for reading with the
knode read
command.
If no filename is specified, its name is derived from the node name with a .knd (
KNIME
node definition) suffix. If an explicit empty filename is specified (including
None
for
Python
), an in-memory string blob is produced, without writing to a file.
The definition file only saves the node definition with all attributes, ports and parameters, but no execution state or execution result information.
The return value is the file name, or, in case of blob output, the definition file contents.
knode writeconfig
knode writeconfig ?filename?
Knode.Writeconfig(?filename=?)
Write the current system configuration regarding the
KNIME
node subsystem to a file. If no file name is given, the default configuration filename csconfig.xml in the current directory is used.
Files of that name are automatically read on start-up if they are in the current working directory, or in a standard location such as the home directory or the
Cactvs
installation directory, or passed as a program option when the interpreter is started. This makes it easy to maintain a custom node execution environment without explicitly setting many custom configuration variables.
The return value is the file name.
knode writedoc
knode writedoc khandle ?filename?
k.writedoc(?filename=?)
Write a
HTML
file for a node which looks very much like the contents of the node description panel in the
KNIME
workbench. The original documentation compiled into the node
JAR
files is
XML
-coded, so this is not exactly the same data. The constant contents of the RPC and Source tabs are omitted.
If no node name is specified, a name is automatically constructed from the node name and a .html suffix. If an explicit empty filename is specified (including
None
for
Python
), the output is an in-memory string blob, not a file
The return value is the file name, except in case of blob output, when it is the
HTML
file contents.
knode writescript
knode writescript khandle ?filename?
k.writescript(?filename=?)
Write a
Tcl
or
Python
script which, when run, faithfully recreates the node definition and writes out a new
XML
node definition file and a new
KNIME
JAR
file. Editing these scripts in the context of custom node development is much more convenient than manipulating the content of the native
XML
-based node definition file. For simple node source code distribution, the
XML
format is more suitable.
If the file name has a .
tcl
suffix, the output is a
Tcl
script. The script language is automatically switched to
Python
if the file name has a .
py
suffix. If none of these suffixes is used, the script language configured via the
defaultlanguage
node attribute is used. If that is also unset,
Tcl
is the default. If no file name argument is used, the file name is constructed from the node name and the appropriate language suffix. If an explicit empty filename is specified (including
None
for
Python
), the output is an in-memory string blob, not a file.
The return value is the file name, except in case of blob output, when it is the script file contents.
knode writetest
knode writetest khandle ?filename?
k.writetest(?filename=?)
Automatically generate a
Tcl
or
Python
test script for a node. The command line arguments for the script are port data file names for all non-optional input ports, optionally file names to store the output of ports, and a parameter dictionary. The script contains readable comments to self-document its use.
If the file name has a .
tcl
suffix, the output is a
Tcl
script. The script language is automatically switched to
Python
if the file name has a .
py
suffix. If none of these suffixes is used, the script language configured via the
defaultlanguage
node attribute is used. If that is also unset,
Tcl
is the default. If no file name argument is used, the file name is constructed from the node name with a
_test
name modification and the appropriate language suffix. If an explicit empty filename is specified (including
None
for
Python
), the output is an in-memory string blob, not a file.
The return value is the file name, except in case of blob output, when it is the script file contents.