Skip to content

Simple Reducer

Overview

Simple Reducer is a reducer that produces a JSON containing an array whose items have keys taken from the outputs of the blocks of the reference context.

Input

The input variables are completely custom and defined as block properties.

Input variables are valued as many times as there are iterations of the reference context and they double as the keys of each item of the output array.

Block properties

The properties of a Simple Reducer block are accessed by editing the block and are divided into these groups:

  • Basic properties:

    • Block name
    • Component version (read only)
    • Block ID (read only)
  • Functional:

    • Field name for the array: name of the output array.
    • Context to reduce: reference context. It is chosen from a drop-down. To remove the choice, select Clear .
  • Deployment:

    • Timeout: execution timeout expressed in minutes (m) or seconds (s).
    • Replicas: number of required instances.
    • Consumer Number: number of threads of the consumer, the software module of the block that provides input to process by taking it from the block's work queue.
    • Memory: required memory.
    • CPU: thousandths of a CPU required (for example: 1000 = 1 CPU).
  • Input: the properties in this group correspond to custom input variables that must be mapped to the output keys of blocks in the reference context. Input variables are given a value for each iteration of the reference context and become the keys of each item of the output array.

    • To define a new input variable, in the Input tab of the properties pop-up:

      1. Click the plus button: a new row is added below the list of existing properties.
      2. In the left field enter the name of the input variable (that doubles as an output key).
      3. Using the drop-down choose the corresponding key from the list of the output keys of the context blocks.

        First of all select the type of the property choosing between number, string, boolean, object and array. After that, the list below will only show output keys of the same type.

        The list is divided in groups, one group for each context block. Select the expand and collapse icons to the right of the block name or select the name of the block multiple times to show or hide the sub-list of output keys for that block.
        If the type of the property is object, the first entry in the sub-list is the block name.

        By choosing it, you indicate that the value of the input variable will coincide with the entire output JSON of that block.

        Note

        The drop-down list shows all the first-level keys that can, potentially, be available, but the keys that are actually there when executing the workflow may be less. If you map a key that's not actually produced at runtime, the corresponding output object will be set to null.

        To cancel the mapping process, select No mapping from the list or, if you already chose a key, select Clear .

    • To modify an existing input variable:

      • Edit the left field to change the name of the variable.
      • Use the drop-down as described above to choose a different source.
    • To remove an existing input variable, select Remove to the right of it.

  • Output: read-only, this property is a navigable description of the structure of the output array.

Output

A Simple Reducer block produces a JSON object containing an array whose name is the value of the functional parameter Field name for the array (see in the block properties described above).
Each item of the array is an anonymous object with the keys defined in the the Input tab of the block properties pop-up. The structure of the array and its items can be seen in the Output tab of the same pop-up.