Execution engine¶
xDash execution engine implements a synchronous/reactive scheduling algorithm.
DataNode instances are the nodes of a direct acyclic graph where edges are data dependencies. They each own a status describing their latest execution state. Last update time indicates the time of the last successful execution.
DataNodes status¶
May have one of the following values :
- None : execution of the dataNode has not happened yet.
- Pending : execution of the dataNode is pending. This happens when a web-service call takes some time to complete.
- OK : last execution of the dataNode has completed sucessfully.
- Error : last execution has completed with error.
Execution rules¶
- DataNode is executed if and only if all its predecessors completed their execution with an OK status.
- Every time a dataNode is succesfully computed (status "OK"), it triggers the execution of all its successors.
- Graph execution is interrupted at dataNodes with an Error status. Their successors are not executed.
Schedule instance¶
- At first start, graph is scheduled in a breadth-first order starting from source nodes. This is the first schedule instance.
- Some dataNodes might be updated through different ways : widget value written to dataNode, file imported into dataNode, formula modification, user refresh of dataNode... Such update launches the execution of the corresponding dataNode and a new scheduling instance.
Execution flow control parameters¶
The graph execution is controlled by the execution flow control parameters specified in dataNodes.
autostart¶
When set to false, the associated dataNode is not executed on first execution of the dashboard nor in subsequent ones.
Otherwise, i.e. when set to true, default dataNodes execution behavior applies: all nodes are executed by the xDash runtime when all their predecessors successfully completed.
For example, autostart can be set to false to avoid executing a heavy computation web-service at project load.
Default value is true.
sample time¶
- When different from 0, the dataNode is executed every sample time. It's useful for ensuring a periodic real-time execution behavior.
- Every time a non null sample time is defined, the execution engine computes the greatest common divisor and use it as a its base timer.
Sample time is expressed in seconds and must be a multiple of 0.1s. Default value is 0.
explicit trig¶
- When set to true, the dataNode, in terms of execution flow control, is considered as a source node with autostart set to false. It is no longer executed when a direct predecessor is updated. With this setting, it is only executed when it is explicitly triggered by an associated push button widget or by a click on the dataNode update icon present in the dataNodes list of tabs 1 or 3. Please refer to the Triggered POST example above.
- Otherwise (i.e. when set to false), default dataNodes execution behavior applies. Useful for implementing a form-like behavior (setting independently all required dataNode inputs, without executing it with each update, then explicitly triggering its execution).
Default value is false.
Execution flow control parameters : summary¶
The table below summarizes the execution flow control parameters for the currently available dataNode types in xDash. Of course, data flow dependency induces an execution flow dependency, except when explicit trig is used.
A checkbox in the table indicates that the property can be customized by the user (true or false). Otherwise, they have the default value indicated above.
Type | autostart | sample time | explicit trig |
---|---|---|---|
Variable | |||
Formula | |||
REST web-service | |||
Python script | |||
Python inline | |||
Generic file reader | |||
CSV file reader | |||
CSV file player | |||
Map matching | |||
Trip conversion | |||
Geolocation | |||
Clock | |||
Delay | |||
MQTT | |||
WebSocket receive | |||
WebSocket send |
DataNodes capabilities¶
In addition to execution flow control parameters, dataNodes may have common capabilites depending on their type.
setInput with formula¶
JavaScript code can be written to define input to dataNode computation.
setValue from widget¶
Currently only Variable dataNodes have this property. It indicates that their workspace value can be modified by widgets that have write capabilities (such as sliders (horizontal slider ...), value, editable table ...).
setValue from file¶
The value of the dataNode can be assigned from a file. See example in Push button.
DataNodes capabilities : summary¶
The table below summarizes currently available dataNodes in xDash, as well as their major properties in terms of execution flow and data flow.
Type | setInput with formula | setValue from widget | setValue from file |
---|---|---|---|
Variable | |||
Formula | |||
REST web-service | |||
Python script | |||
Python inline | |||
Generic file reader | |||
CSV file reader | |||
CSV file player | |||
Map matching | |||
Trip conversion | |||
Geolocation | |||
Clock | |||
Delay | |||
MQTT | |||
WebSocket receive | |||
WebSocket send |