Handle Scripts in Distributed Systems

This set of methods allows for a better operation in distributed systems.

  • isDistributed
  • getOnlineSystems
  • getCurrentSystem

Syntax

 

var isDistributed = isDistributed();

 

var systems = getOnlineSystems();

 

var currentSystem = getCurrentSystem();

 

Result

  • isDistributed returns True if the project where the script runs is in a distributed environment.
  • getOnlineSystems returns a SystemObject array that contains the list of the systems that are online.
  • getCurrentSystem returns a SystemObject that contains the current system information.

Examples of Use

 

How to read the isDistributed result

var result = isDistributed();

console("IsDistributed? {0}", result);

 

How to read the getOnlineSystems result

var systems = getOnlineSystems();

systems.forEach(function(system) {

console(system);

console(system.systemId);

console(system.systemName);

});

 

How to read the getCurrentSystem result (indicating the system where the script is running)

var currentSystem = getCurrentSystem();

console(currentSystem.systemId);

console(currentSystem.systemName);

 

The Console expander will display a line for each system connected in a distributed environment.

 

How to use SystemObject in a filter

var system = getCurrentSystem();

var filter = new Filter();

filter.systemId = system;

// add other filter conditions

filter.name = "Scripts";

var results = searchSync(filter);

results.forEach(console);

 

How to filter the systemId parameter with SystemObject

var systems = getOnlineSystems();

var filter = new Filter();

filter.systemId = systems[0];

// add other filter conditions

filter.name = "Scripts";

var results = searchSync(filter);

results.forEach(console);