LogoLogo
About
  • Home
  • Guides
  • BDK
  • REST API
  • Release Notes
  • Getting Started
    • What is Kognitos?
    • Logging In
    • Account Setup
    • Quick Start Guide
    • Core Concepts
  • Writing Automations
    • Automation Basics
      • Defining Data
      • Comments
      • Conditionals
      • Keywords
      • Loops
    • Calling Other Processes
      • Calling A Subprocess
      • Invoking a Subprocess
      • Starting Parallel Runs
    • Validating Data
    • Context Based Learning
    • Using the Debugger
  • Books
  • Automation Management
    • Scheduled Processes
    • Email Triggers
    • Enterprise Dashboard
    • Starring Data
  • Exception Handling
    • Providing Guidance
    • Resolving Common Exceptions
    • Learnings
  • Account Management
    • API Keys
    • User Roles & Permissions
Powered by GitBook
On this page
  • Overview
  • How Can I Start Parallel Runs?
  • Handling Subprocess Runs
  • Walkthrough: Run Parallelization

Was this helpful?

Export as PDF
  1. Writing Automations
  2. Calling Other Processes

Starting Parallel Runs

Learn how to start parallel runs in Kognitos.

Overview

In Kognitos, a process can call and run multiple subprocesses in parallel using the start a run syntax. Starting parallel runs enables the parent process to explicitly wait for the runs, retrieve the statuses, and fetch the outputs.

                       Parent Process
                             │
     ┌-----------------------┴------------------------┐
     │                       │                        │
     │                       │                        │
Parallel Subprocess    Parallel Subprocess    Parallel Subprocess

This method is ideal when multiple subprocesses need to run simultaneously and you need to retrieve the statuses or outputs of multiple runs.

How Can I Start Parallel Runs?

This section describes how to start parallel runs using the start a run syntax.

Syntax

process each item as follows:
    start a run where
        the procedure is "{subprocess name}"
        {input}

Parameters

  1. item: Object to loop over.

  2. subprocess name: The name of the subprocess.

  3. input: Objects to pass to the subprocess, if necessary.

Example

the items are "apples", "flour", "eggs", "milk"
process each item as follows
    start a run where
        the procedure is "to make apple pie"
        the ingredient is the item

Remember to Publish Your Process

You need to promote your automation from the Playground to a Process in order to start parallel runs. This applies to both the main parent process and the subprocess. Otherwise, you will get an Assertion Error saying procedure not found.

Handling Subprocess Runs

A parent process can explicitly wait for the runs of a subprocess. By waiting for completion, a parent process can also collect the data and outputs from all the subprocess runs.

Adding an Explicit Wait

To add an explicit wait, include the following line into your automation after starting parallel runs:

wait for the runs

Once this is executed, a tab will appear in the user interface, allowing you to view the status of each individual run.

Customizing the Wait Time

You can customize the wait time by adjusting the wait count before starting parallel runs.

  • The wait count refers to the number of 5-second intervals.

  • The wait time is calculated by multiplying the wait count by 5.

  • The default wait count is 60.

  • The default wait time is 5 minutes (60 x 5 = 300 seconds, or 5 minutes).

the department's max retry wait count is {intervals}

In the example below, setting intervals to 3 results in a total wait time of 15 seconds (3 x 5 seconds).

the department's max retry wait count is 3

Getting Output From Parallel Runs

To get results from subprocesses that are called with the start a run syntax, use the following syntax after adding an explicit wait:

Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

retrieve data from the run(s)

What does it do? Instructs the system to retrieve data from the parallel run(s).

Where does it go? This phrase should be written on a new line.

Does it require input data? ⛔ No — This phrase does not require input data.

the fact names are

What does it do? Specifies the name of the data elements to retrieve from the parallel runs.

Where does it go? This phrase should be indented below retrieve data from the run or retrieve data from the runs.

Does it require input data? ✅ Yes — Specify one or more text values containing the names of the data elements.

Example: The fact names are "status", "name", "age"

Examples

1. Singular Run

retrieve data from the run where
  the fact names are "output sum"
get the output sum from the data

2. Multiple Runs

retrieve data from the runs where
  the fact names are "status"
get the statuses from the data

Automatic Pluralization: If there are multiple runs, the system will automatically pluralize the output in the parent process (e.g., status -> statuses).

Walkthrough: Run Parallelization

This is an example walkthrough of invoking multiple instances of a subprocess in parallel runs.

Parent Process

the department's max retry wait count is 2
the names are "Eva", "Ivan", "Leo", "Nia", "Zoe"
process each name as follows
	start a run where
		the procedure is "to greet the user"
		the user is the name 
wait for the runs
retrieve data from the runs
  the fact names are "greeting"
get the greetings from the data
Line #
Description

Line 1

The wait count is set to 10 seconds (2 intervals of 5 seconds).

Line 2

A data element is defined as a list of names.

Line 3

Initiates a loop across the list of names.

Line 4

Initiates subprocess invocation using start a run where syntax.

Line 5

Specifies the name of the published subprocess to call.

Line 6

Passes input to the subprocess: the name is passed as the user.

Line 7

Sets an explicit wait for the subprocess runs.

Line 8

Explicitly retrieves the greeting output from the subprocess runs.

Subprocess

Line #
Description

Line 1

Data is defined as a string that says "Hello "

Line 2

The user is added to the end of the greeting.

Line 3

The automation outputs a greeting with the user's name at the end.

Subprocess Output

In line 9, the greetings is referenced as output from the subprocess runs. The results are:

  • Hello Eva

  • Hello Ian

  • Hello Leo

  • Hello Nia

  • Hello Zoe

Additionally, each individual run can be clicked through in the platform:

Last updated 9 days ago

Was this helpful?

Click to walk through an end-to-end example.

here