Skip to main content

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 exec setting gets passed the shell (/usr/bin). In this case the exec setting must be given as a string.

If not set, we will directly execute the sub-process via execvpe(2). In this case the exec setting must be given as an array (argv[]).

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": [
    ],
  • "flush": true,
  • "working_directory": "string",
  • "environment": { },
  • "in": {
    },
  • "vectorize": 1,
  • "hooks": [
    ],
  • "builtin": true,
  • "out": {
    }
}

Example

node/etc/examples/nodes/exec.conf
nodes = {
exec_node = {
type = "exec"
format = "villas.human"
flush = true
exec = "tee test"
shell = true
working_directory = "/tmp"
environment = {
MYVAR = "TESTVAL"
}
}
}