Aug 5, 2018

Run processes in parallel using only one TM1 connection

Being able to run processes in parallel is one of the most powerful features of IBM TM1 and Planning Analytcs. Instead of loading one year of data with one process, you could run in parallel one process per month which will significantly speed up your loading time!

Run processes in parallel with TM1RunTI

Running processes in parallel is quite common now in IBM TM1 and Planning Analytics applications. The most common way to do it is to use TM1RunTI.

TM1RunTI is an exe file which is located in the TM1 bin installation folder. With a simple command line as below you can run multiple processes in parallel:

"C:Program FilesCognosTM1bintm1runti.exe" -process Cub.Flight -adminhost CW111 -server flightstats -user TI01 -pwd "" pYear=2000 pMonth=01"C:Program FilesCognosTM1bintm1runti.exe" -process Cub.Flight -adminhost CW111 -server flightstats -user TI02 -pwd "" pYear=2000 pMonth=02"C:Program FilesCognosTM1bintm1runti.exe" -process Cub.Flight -adminhost CW111 -server flightstats -user TI03 -pwd "" pYear=2000 pMonth=03

Manage running processes with Hustle

Hustle was created to manage the threads and making sure that you do not exceed the number of available threads on the server. Hustle uses TM1RunTI, therefore it has the same limitation, for each thread, it will first need to connect to TM1 to be able to execute it.

In certain applications, TM1 developers had to set up one different user per thread to avoid locking.

Run processes in parallel with only one connection

To avoid this situation RushTI was created:

RushTI does the same as Hustle except that it connects to TM1 only once at the beginning and then reuses the same connection to run all threads.

This article will explain you how to install and use RushTI.

Prerequisites:

  • TM1 10.2 FP5 as minimum
  • TM1py v1.0.3 as minimum

1. Install Python

RushTI is a Python script, to run it, you will first need to install Python. Steps to install Python can be found here.

2. Install TM1py

RushTI uses the free Python package TM1py, so the next step is to install the TM1py package. Open a command prompt and then type:

pip install TM1py

3. Download RushTI folder

RushTI is an open-source Python script which you can download from its github page:

In this example, the RushTI folder has been copied to the C:RushTI folder:

4. Update config file

In the config file example, you will find two instances but you can add as many as you want, to add a TM1 instance just add the following information:

  • [instanceName]
  • address: IP address of the physical server where the TM1 instance is located
  • port: HttpPortNumber of the instance (tm1s.cfg)
  • namespace: (only required for CAM Security)
  • user: TM1 user
  • password: TM1 user password (encoded in Base 64)
  • ssl: True/False (depending useSSL setting in tm1s.cfg)

WARNING: The password needs to be encoded in Base 64.

TM1py supports all TM1 security mode, more information in this article:

5. Update tasks.txt

The file tasks.txt contains the list of all processes which are going to be executed by RushTI. In this example, the process Cub.GeneralLedger.LoadFromFile will be executed for every months:

instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=01instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=02instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=03instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=04instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=05instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=06instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=07instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=08instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=09instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=10instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=11instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=12

It can be noted that in the same list, you can run processes from different TM1 instances by changing the instance parameter:

instance="tm1srv01" process="Cub.GeneralLedger.LoadFromFile" pMonth=01instance="tm1srv02" process="Cub.GeneralLedger.LoadFromFile" pMonth=01

6. Run RushTI from command line

To run RushTI as a command line, just use the following command (the last parameter is the number of threads RushTI will run at the same time):

python RushTI.py Tasks.txt 4

If you are not in the RushTI folder, you will have to add the path to the script:

python C:RushTIRushTI.py C:RushTITasks.txt 4

The following video shows the Pulse Live Monitor with 4 threads running at the same time:

  •  

Run RushTI from a TM1 process

To run RushTI from a TM1 process, you just need to use the ExecuteCommand function either in the Prolog or Epilog tab:

sCommand = 'python C:RushTIRushTI.py C:RushTITasks.txt 4';ExecuteCommand(sCommand,1);

The second parameter is either 1 if you want to wait for the command to finish or 0 to termiate the process straight away.

Troubleshoot RushTI

If the threads are not running, the best place to start looking at, is the log file. RushTI will create a RushTI.log file in the same folder location as the RushTI.py.

The most common errors are the following:

  • RushTI can’t connect to TM1 instance so you should check first the settings in the config.ini (Check connectivity with TM1).
  • TM1py version should be v1.0.3 as minimum (Upgrade TM1py).
  • Check parameters of the TM1 processes.

Related content

Loading related content