exec
hide_table_of_contents: true
Execution of Sub-processes
The exec node-type spawns a new subprocess and exchanges sample data via stdin and stdout.
Prerequisites
This node-type does not have any special library dependencies. It is always available.
Implementation
The source code of the node-type is available here: https://github.com/VILLASframework/node/blob/master/lib/nodes/exec.cpp
Configuration
Format Object (object) or Format Name (string) (format_spec) | |
| shell | boolean Default: false If set, the If not set, we will directly execute the sub-process via |
Array of strings or string The program which should be executed in the sub-process. The option is passed to the system shell for execution. | |
| flush | boolean Default: true Flush stream every time VILLASnode passes data the sub-process. |
| working_directory | string If set, the working directory for the sub-process will be changed. |
| environment | object A object of key/value pairs of environment variables which should be passed to the sub-process in addition to the parent environment. |
object (Input configuration (received by VILLASnode)) | |
| vectorize | integer Default: 1 This setting allows to send multiple samples in a single message to the destination nodes. The value of this setting determines how many samples will be combined into one packet. |
Array of Hook Object (object) or Hook Name (string) (hook_list) | |
| builtin | boolean (Builtin hook functions) Default: true By default, each node and paths has a couple of default hooks attached to them. With this setting the attachment of built-in hooks can be disabled. |
object (Output configuration (sent out by VILLASnode)) |
{- "format": "villas.human",
- "shell": false,
- "exec": [
- "string"
], - "flush": true,
- "working_directory": "string",
- "environment": { },
- "in": {
- "signals": [
- {
- "name": "tap_position",
- "type": "integer",
- "init": 0
}, - {
- "name": "voltage",
- "type": "float",
- "unit": "V",
- "init": 230
}
], - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}, - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
], - "builtin": true,
- "out": {
- "vectorize": 0,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}
}Example
nodes = {
exec_node = {
type = "exec"
format = "villas.human"
flush = true
exec = "tee test"
shell = true
working_directory = "/tmp"
environment = {
MYVAR = "TESTVAL"
}
}
}