Create a task

To create a mass management task, select the Task Management perspective from the Dashboard of the IoT Manager Console (the console for short). You can also use the permanent shortcut icon for this perspective, namely images/confluence/download/thumbnails/1164399864/dm_tasksManagementIcon.png available in the upper left corner of the Dashboard.

Once there, click Launch Task to start the wizard which will navigate you through the necessary steps.

images/confluence/download/attachments/1164399864/Create-a-Task-2.png

Define task name and action script

On the first dialogue of the wizard:

  1. Enter a user-friendly name for the new task, which will help you identify it later on when you monitor and potentially control its execution

  2. Enter the Groovy action script which will be executed by the task, then click Next. For detailed explanation on how to write action scripts for Bosch IoT Manager, refer to the conceptual guide section dedicated to Groovy Actions.


    For example, this is an action script which you can use to stop the Fileupload bundle on a Bosch IoT Edge-based device, which has installed Edge Services:

    bundle = target.feature('Bundle:org.apache.commons.fileupload')
    bundle.stop()

images/confluence/download/attachments/1164399864/mme_launchTask1.png

Define execution scope

On the next dialogue of the wizard, select the scope with which the task will be executed - device scope or system scope.

Regardless of the name, both scope options can be used for device management and the difference lies in the way in which the action script will be executed. Generally, it is recommended to use device scope (selected by default), unless you have a specific use case which requires system scope. For details, refer to Action execution depending on the scope.

Our sample action script above is intended for device scope.

Creating a task with device scope

There are three ways to define device scope, available as options in the dropdown menu of Scope Selection Mode.

  • Group Selection - the default option that appears in the Scope Selection Mode field allows you to select an already created directory group on whose devices the task will be executed. In the Context Group Path field you can directly type the path to the relevant group or click the icon to the right to browse the existing groups.

images/confluence/download/attachments/1164399864/dm_mme_createTask_groupSelection.gif

The devices in the selected group can be further filtered by applying:

  • A Groovy Filter Script - see example on the screenshot above

  • An RQL Device Filter - see example on the screenshot above

  • Tags - to be selected from the already created tags available in the dropdown menu.

For the first two Scope Selection Mode options you can also specify if you want to search for Gateways Only or for their edge devices as well.

Тhe Recursively option will add also all devices from subdirectories of the selected directory.

  • Ids Selection - allows you to add individual devices to your scope. To do so, follow the steps.

  1. Click Add

    images/confluence/download/attachments/1164399864/dm_mme_createTask_idsSelection1.png

  2. If you see your device in the Add Devices dialog you can directly select it, otherwise you have to find it as described in step 3.

  3. Devices can be filtered through tag groups, directory groups or IDs/RQL expressions. Use the images/confluence/download/thumbnails/1164399864/switch_filter_icon.png icon to switch between ID and RQL filtering mode.

  4. When found, select the desired device and click OK, upon which it will appear on the list of devices included in the scope.

images/confluence/download/attachments/1164399864/mme_scope_ID_SelectionGif.gif

All bundle-related examples require the selection of the bundle thing e.g. example.dm:gatewayDevice:edge:services:bundles as seen in the screenshot above.

Removing a device from the list is possible through the Remove button.

  • Groovy Selection - allows you to select the devices on which the task shall be executed via a Groovy List Script and optionally a Groovy Filter Script. On the screenshot below, the example Groovy list script will retrieve 100 devices corresponding to the list of 100 device IDs generated by the script:

images/confluence/download/attachments/1164399864/dm_mme_createTask_groovySelection.png

The steps by which you define the Execution Scope and the three Scope Selection Modes are identical for tasks and rules.

Once you have selected the scope of devices you want to execute the action on, click Next.

Creating a task with system scope

Following the initial steps of the wizard, at the Execution Scope dialogue, click System Scope and then Next.

When creating tasks with system scope, it is essential to consider that system scope is recommended in very specific use cases, and the Groovy action script has to be written with system scope in mind. Detailed explanation is available in Action Execution depending on the Scope.

images/confluence/download/attachments/1164399864/system-scope-option.png

Define execution options

The dialogue that follows specifies whether you want to apply execution options for the task. In particular, for:

  • Concurrency Limit – enter any positive number to indicate the maximum number of devices for which the task can be executed simultaneously

  • Concurrency Timeout - enter a concurrency timeout in seconds upon which a non-confirmed execution will expire and will stop occupying room in the concurrency limit

  • Time Constraint – enter a Cron expression to define a time window for the execution, for example * * 12-13 * * ? in which case the task will only run from 12 pm to 14 pm every day until it has finished for all devices in its scope.

images/confluence/download/attachments/1164399864/Launch-new-task-wizard---Execution-Options.PNG

Then click Finish, upon which the newly created task will automatically start executing on all devices included in its scope, in accordance with the limitations posed by the execution options, if any.