runBulk(__calledRobot,__argument,__options*);

Description

RunBBulk is similar to callbot, but enables the user to do multiple calls for exactly the same robot in parallel.

Iterates over arguments (a particular order is not guaranteed) and for each of these arguments it will run the specific called bot, passing that argument through to the robot.

Argument

The argument can be a single atomic value, an iterator or a list. Once a robot is called with runBulk, the used argument behaves the same way as the argument of the callbot.

  • argument is empty/null: the statement will not run anything
  • single atomic: the robot is called once with the argument passed to it
  • iterator or list: the robot is called once for every element, with that element passed to it

Options

This optional parameter is an object that can contain two specific elements:

  • "stopOnError":"yes" (default is "no"): will stop/break called robots that generate an error message
  • "maxThreads":__number (default is the amount of logical CPU core of the computer it's running on): specifies the maximum number (>0) of robots that will run at the same time.

Example

Main robot:

use System;

System.print("Starting...");
var count = runBulk("runBulk1.xill", [1,2,3,4,5], {"maxThreads":3, "stopOnError":"yes"});
System.print("Total amount of instances run: "::count);

Called robot:

// runBulk1.xill
use System;

argument arg;
System.print("Start called bot: " :: arg);

var i = 0;
while (i<10) {
    System.print("Robot: " :: arg ::", iteration: "::i++);
    System.wait(1000);
}