TC2.28 - Snap4City MicroServices for Snap4City platform management from IOT Applications, feature of reflection

×

Warning message

  • You can't delete this newsletter because it has not been sent to all its subscribers.
  • You can't delete this newsletter because it has not been sent to all its subscribers.

Test Case Title

TC2.28 - Snap4City MicroServices for Snap4City platform management from IOT Applications, feature of  reflection

Goal

I can:

  • Use Microservices to retrieve information, to pause, to resume and to trigger job on platform
  • Start more sophisticated processes from IOT applications such as MapReduce, Spark, data processing bulk, data production in bulk, etc.

Prerequisites

Know the host where is hosted the process loader that run the desired process.

Know the features and functionality offered by DISCES

Download or ask for permits to enable you to develop your own process

The following functionalities are available only for specific Snap4city users with specific privileges.

Expected successful result

Starting a new job, read current status of a job

Steps

 

 

  1. In the Snap4City project, microservices have been developed that allow process management to be carried out.
  2. The microservices are located under the S4CManagement menu and are divided according to the functions they provide. There are those who provide information about the system that contains the processes to be performed and respond with TRUE or FALSE

  1. There are those that provide information about jobs and triggers related to jobs and return more information than the previous ones, even with lists and objects

  1. The ones described so far are microservices that only take readings inside the host indicated in the configuration. The following microservices allow you to interact with the platform and start or stop processes in the system

  1. An example of how such nodes can be used is the following
  2. After deepening the study of the DISCES and have prepared the development environment as described here.
  3. Open a Flow in your cloud (TC2.1a) or local (TC2.1b) IotApplication
  4. Import for testing the flow  " TC2.28 - Snap4City MicroServices for Snap4City platform management" with the steps described in TC2.13 (on cloud) or import it from a file (if you have not an IOT Application on cloud)
  1. Check the imported node and change values of configuration tab to use your own job

  1. Configured on a desired job:

  1. This node return a TRUE value if the job exist in that machine, so add a “switch” node from “functions” menu:

  1. And configure it as follows:

  1. Then, add the “get-currently-executing-jobs” node from the “S4CManagement” menu

  1. And configure it as follows

  1. Next step it is check if the desired job is running, searching its name in the list of running jobs. This can be made with a “switch” node:

  1. Configured like:

  1. If the job is running msut be notified to the dashboard with “The job is running” message. Otherwise, the job can be triggered with a “trigger job” node from “S4cManagement”:

  1. Configured as follows:

  1. If the job start correctly a message “job triggered” is show on the dashboard and a check is made to write “job completed” at the end of the running. To make this check it is possible to add a “trigger” node that check if the job is running and reset the trigger when the job complete its work:

  1. The trigger node must be configured:

  1. The get-currently-executing-jobs as follows:

  1. And the switch:

  1. The function node create the reset command for the trigger node:

  1. At the end a “text” node from “dashboard menu must be added to notify the user about job status:

  1. Configured like:

  1. And in addition a “template” node containing an iframe with the Datagate site to show the last job executed, is added:

  1. Configured like:

  1. The resulting flow is:

  1. And if you go on the node-red dashboard, it shows the results as following if you use datagate in your job: