Profile picture for user egambrell

Hi -

I've created an import script that creates/updates objects from Excel. I would like to make this run faster with threads, but I can't get the code working.

 

This page was my reference: https://crunchify.com/how-to-run-multiple-threads-concurrently-in-java-executorservice-approach/

 

Does anyone know how to do something like this within the context of the ARIS API? Here is a sample script I was trying:

 

 

var log = "";

 
function main() {
    var MYTHREADS = 4;
    var executor = new java.util.concurrent.Executors.newFixedThreadPool(MYTHREADS);
    var objectNames = ["Object 1", "Object 2", "Object 3", "Object 4"];
     
    for (var i in objectNames) {
         var objName = objectNames[i];
         var worker = new MyRunnable(objName);
         executor.execute(worker);
    }
     
    executor.shutdown();
    // Wait until all threads are finish
    while (!executor.isTerminated()) {
     
    }
   Dialogs.MsgBox("\nFinished all threads");
}
 
function MyRunnable(objName) {
    this.objName = objName;
    
    this.run = function() {
        var result = "";
        try {
            var oObjDef = ArisData.getActiveDatabase().RootGroup().CreateObjDef(Constants.OT_FUNC, this.objName, 1033);
        } catch (e) {
            result = "->Red<-\t";
        }
        log += this.objName + " created\n";
    }
}

main();

by Michael Idengren
Posted on Sat, 04/20/2019 - 21:12

I also need this, for the purpose of running a high volume of automated consolidations.  Every consolidation between two objects takes 30seconds+, and processing 14,000 objects that have one duplicate each is taking many, many hours, with an under-utilized server CPU load between 4-10% ...

0
by Kay Fischbach
Posted on Tue, 04/23/2019 - 08:47

The Java way of multi-threading will most definitely not work, simply because Javascript-Engines were never made to handle those operations.

I'll say it right here upfront: I have no idea whether or not ARIS reports support multi threading. That being said there are two things I want to mention here:

  • Your under-utilized ARIS server CPU probably does not reflect the overall system load. The ARIS server is communicating with a SQL database server, and a lot of the requests being made require answers from the SQL database server (not only those requests where you tell ARIS to look something up, like a list of models from a group, but also whether or not sql-database-write-operations were successful). There is simply a limit to how fast a SQL database can process requests, and it will most definitely process write-operations in sequential order to not mess things up.
  • Multithreading in Javascript is done with things called "Web Worker". They are part of the HTML 5 standard and may not be available in the ARIS Script engine. This is knowledge I have made use of when I dipped into web-developing to widen my Javascript knowledge and therefore I can't tell whether or not it works in ARIS. If you really think you have operations that can be processed faster with multi threading, without messing up anything in your SQL database, go ahead and give it a try, I myself will stay away from it until Software AG says "this is how you do multi threading: [explanation expected]". You can just look up "HTML 5 Web worker" on the world wide web to find out more about them.
0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 04/23/2019 - 09:38

Hi,

have you tried the SAVE_NOW and SAVE_ ahm, on command or whatever ?    Then ARIS will not store each and every single change, but will wait until you tell it so...

Can be tremendously faster for such mass-operations...

Regards Robert

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock