Bosch IoT Device Management - will be discontinued by mid 2024

Partial executions of the groovy action

The Groovy script defining the action of a task or rule usually includes several different methods - synchronous and asynchronous - as well as Groovy closures, all of which have to be called on the devices in the task or rule scope or on the backend system. The execution of each of these methods and closures may be reported and monitored as a partial execution result with its own monitoring attributes.

Generally, the executions of asynchronous methods and closures are reported as partial execution results, whereas the executions of synchronous methods are not. This is so because asynchronous methods are used for sending commands to devices, for example the exec() method or any dynamic method, and their result is not received immediately, whereas synchronous methods are completed instantly and simply enable the mass management process, for example the methods getDeviceId or listDevices. In addition, the return value of the whole аction script, if any, may be reported as a partial execution result as well.

An action script that will be reported with partial executions might look like:

String location = "http://examplerepository.com/exampleBundle"
Closure postAction = {return 'installation completed!'}
target.exec(
 'BundleFactory',
 'install',
['http://examplerepository.com/exampleBundle.jar', ['-s'].toArray()].toArray(), postAction)
return 'installation triggered!'

Reporting the whole action script as a partial execution

The reason for reporting the whole action script as a partial execution result can be understood more easily through the example script provided above. When the whole action script is successfully sent to the device, it will return the result value installation triggered!. Up to this stage, the execution is considered successful because the action script is sent to the device and has returned a value, so its partial execution state will be FINISHED_SUCCESS. However, there is still no information regarding the execution of the actual device management command - the bundle installation. It will be reported separately as a partial execution of the asynchronous method and its closure argument.


Result source

Partial etatе

Result value

Script execution result

success

installation triggered!

target.exec(String, String, Object[], Closure)

success

void method

PostAction-Partb85f5fcf-a431-4713-88b9-02bda7806b38

success

installation completed!

To understand how these partial execution states are summarized and form device execution states, see the Summarizing partial execution states per device section.