Jobs

Jobs are tasks executed once every hour or once a day. You can use the jobs to generate your own kpis and analytics aggregating the data from the events.

Each job must contain a function job(params, callback)

Where:

params is an empty object for now.

callback is a function to be called when the job ends and can contain a parameter string error if the trigger needs to report an error.

The execution of a job is limited to 10 minutes. If the execution takes longer, the server will end the job.

The common use of jobs is to get the data from the events, process it and send to a kpi. But any of the available services can be used at any moment.

Average temperature

The following code takes all events with the type temperature and separates them in two groups, with temperature higher than 0 an lower than 0. Then computes the average and stores to a kpi called avg-temperature:

Top 10 scores

Sort the data and get the top ten values.

Percentiles

Splits the data in 10 parts and gets the median of each one i.e. the values in 5%, 15%, 25%, ... , 95%.

Square of sum of squares

Get all the things of a product

Learn more