How to invoke a Notebook from the FlowEngine?



In this tutorial, we will explain how to invoke Notebook runs from the FlowEngine:.

With the new node "Notebook Launcher", you can now execute complete Notebooks or just the paragraphs that you need, in an orderly manner.


Let's see how you can use that node. To do this, follow the following steps:

  1. Select the "FlowEngine Management" option from the menu:



  2. Select the domain belonging to your user:
  3. Once you are in the domain, drag a node of type "Notebook Launcher" to the flow and double click on it to see its properties.


    The following are the base properties:
    1. Name: The name that you want the node to have when viewing it within the flow.
    2. Onesait Platform Notebook: In this list, select the Notebook on which you want to work.
    3. Workflow mode: If it is active, it allows the execution with the dependencies as they are represented in the flow. For example, take the following flow:


      If the "check" is active, paragraph 3 will be executed when 1 and 2 are. If it is deactivated, paragraph 3 will be executed when any of the others do.
    4. Inputs & Execution: In this tab, select from among the execution modes:
      1. Execute entire notebook:
        1. If this "check" is activated, the entire notebook will be executed, following the paragraph order defined therein.
        2. If it is deactivated, then the single paragraph execution mode is open, showing the following properties:



          1. Input Paragraph selection: Selection of the paragraph you want to execute. The paragraph's ID will appear along with its title in parentheses (if it has been defined).
          2. Input Parameters mapping: If the paragraph has input parameters configured, they will appear for you to fill in. Their values ​​can be informed in different ways:



            1. msg: From a field of the preceeding msg.
            2. flow: From a global variable to the Flow.
            3. global: From a global variable.
            4. string: As a fixed character string.
            5. number: As a fixed number.
            6. boolean: As a fixed true/false logical value.
            7. timestamp: As a fixed timestamp.

    5. Outputs: This tab also changes depending on whether you want to run the entire notebook or just one node.
      1. Execution of a single paragraph: If the Execute entire notebook check is deactivated, the output configuration (outputs) is disabled. Since a single node is executed, the output will be unique.
      2. Complete execution: If the Execute entire notebook check is marked, the following options will appear to define outputs:


        1. Enable Paragraph Output: If you mark it, it allows us to define different outputs with the results of the paragraphs you select.
        2. Split Outputs: The multi output selector is enabled.
        3. Outputs Number: It allows you to choose the number of outputs that you want in the node.
        4. Output Parameters mapping: For each output you have defined, you can select the paragraph whose result will be displayed by that output.

          The result would be the following:


          If you hover over the node's exit pins, you can see the paragraph to which it belongs.

Once the node is configured, you can see the defined outputs, which will have the following structure:


In the msg.payload.body, you will find the following result fields:

  • Title: Title of the executed paragraph.
  • Text: Contents of the executed paragraph.
  • User: User.
  • dateUpdated: Date of last paragraph update.
  • config: Paragraph configuration parameters.
  • settings: Displays the paragraph's input parameters and variables.
  • results: Contains the execution result.
    • code: Indicates whether the execution has been correct.
    • msg: Array with the results of the paragraph execution. Each element will mark the type of data (type) and the result (data).
  • The rest of the fields are informative about when the execution was carried out and the time it took.