Page 1 of 1

TI Process jump tabs (Advanced tabs of TI) without completion

Posted: Fri Aug 05, 2016 10:00 pm
by ttesla
Hi All,

We are trying to run TI processes parallel to load data by leveraging the resources available on TM1 server. To achieve parallelism, developed Wrapper-Master process to do separately each of below,
A) Process to create meta data objects like cubes, subsets, views
B) Batch files to invoke same processes multiple times with unique parameters
C) Process to delete / destroy meta data objects

Issue: In Wrapper-Master process, after completion of processes to create meta data, few processes are added to execute before running parallel processes in Prolog tab of TI (it means these processes will be executed before start of any other processes in Epilog) and batch files are called from Epilog to run parallel processes, issue is even tough processes in Prolog tab not complete, processes in Epilog are kicked off.

Not sure what is causing to run processes in Epilog without completing processes in Prolog?

Appreciate if somebody can help me.

Thanks

Environment: TM1 10.2.2 (IBM Cloud)

Code
##pYear, pMonth is parameter value

##Prolog
######### Ensure the Right Month's Dimension is Used #########
ExecuteProcess ('Temporary - Create Dimensions', 'pVersion', 'Actual', 'pYear', pYear);
######### End #########

######### Export Config File to Declare Month for Batch Files #########
DatasourceASCIIQuoteCharacter = '';
sDir = '/..../..';
sFileName = 'log.txt';
sFile = sDir | sFileName;
ASCIIOutput (sFile, 'set month="' | pmonth | '"');
######### End ########

######### Ensure Proper values in the cube #########
ExecuteProcess ('P1 - Import Base Numbers from Source', 'pVersion', 'Actual', 'pYear', pYear);
ExecuteProcess ('P2 - Import from Agreement ID', 'pYear', pYear);
######### End #########

###Epilog
Sleep (15000);
######### Start Parallel Interaction #########
sFileEnding = '.bat';
sProDim = 'Pro Process';
i = 1;
iMax = DIMSIZ (sProDim);
While (i <= iMax);
sElement = DIMNM (sProDim, i);
sFile = sDir | sElement | sFileEnding;
ExecuteCommand (sFile, 0);
i = i + 1;
END;

######### End #########

######### Verify That All Processes Have Completed #########
sSuccessFileEnding = '-Pass.txt';
sFailedFileEnding = '-Fail.txt';
sProDim = 'Pro Process';
sBF1 = 'Failed File Found.txt';
sBF2 = 'Processes Not Completed.txt';

k = 1;
kMax = 240;
sCompleteFlag = 'N';

While (k <= kMax);
Sleep (30000);
If (sCompleteFlag @= 'Y');
k = kMax + 1;
Else;
i = 1;
iMax = DIMSIZ (sProDim);
While (i <= iMax);
sElement = DIMNM (sProDim, i);
sFailedFile = sDir | sElement | sFailedFileEnding;
sSuccessFile = sDir | sElement | sSuccessFileEnding;
If (FileExists (sFailedFile) = 1);
ASCIIOutput (sDir | sBF1, sFailedFile | ' was found. Process Terminated.');
ProcessBreak;
EndIf;
If (FileExists (sSuccessFile) = 0);
i = iMax + 1;
sCompleteFlag = 'N';
EndIf;
If (FileExists (sSuccessFile) = 1);
If (i = iMax);
sCompleteFlag = 'Y';
Else;
i = i + 1;
EndIf;
EndIf;
END;
k = k + 1;
EndIf;
END;
If (sCompleteFlag @= 'Y');
# Proceed as Planned
Else;
ASCIIOutput (sDir | sBF2, 'The Processes Did Not Complete in the Time Allotted. Process Terminated.');
ProcessQuit;
EndIf;
######### End #########
######### Some more to run #########
ExecuteProcess ('P3 - OpEx', 'pVersion', pVersion, 'pYear', pYear);
ExecuteProcess ('P4 - Consolidate Source Data', 'pVersion', pVersion, 'pYear', pYear);

######### Move Data to the Reporting Cubes #########
ExecuteProcess ('P6 - Reporting Cubes', 'pMonth', pYear);

Re: TI Process jump tabs (Advanced tabs of TI) without completion

Posted: Sat Aug 06, 2016 10:59 pm
by paulsimon
Hi

You should always check return codes when using ExecuteProcess. I suspect that one of your processes is erroring and that is causing control to go to the Epilog.

eg

vError = 0 ;

vPro = '...' ;
vRet = ExecuteProcess( vPro , .... ) ;
IF( vRet <> ProcessExitNormal() ) ;
vError = 1 ;
vMsg = 'Error running process ' | vPro | ' for params ' | ... ;
ItemReject( vMsg ) ;
ENDIF ;

EPILOG

# Tidy up eg set logging back on cubes

...

# Check for error

IF( vError <> 0 ) ;
# Log error message eg in cube
CellPutS( vMsg , .... ) ;
ProcessQuit ;
ENDIF ;

# Additional code to trigger parallel processes

Regards

Paul Simon

Re: TI Process jump tabs (Advanced tabs of TI) without completion

Posted: Mon Aug 29, 2016 5:13 pm
by ttesla
Thanks Paul for solution.

As shown in example, updated my code to catch return values and incase of expected output proceed to Epilog other wise Quit wrapper process, but some-how without completion of sub processes moving to Epilog.

Is there any other way to handle this issue.

Thanks
Tesla
Updated Code in prolog:
If ( nError = 0 ) ;
nRet = ExecuteProcess ('P2 ', 'pVersion', 'Actual', 'pYear', pYear);

IF( nRet <> ProcessExitNormal() ) ;
nError = 2 ;
sMsg = 'Error 2 running process ' ;
nRet = 0;
ItemReject( sMsg ) ;
EndIf;
EndIf;

If ( nError = 0 ) ;
nRet = ExecuteProcess ('P3', 'pYear', pYear);
IF( nRet <> ProcessExitNormal() ) ;
nError = 3 ;
sMsg = 'Error 3 running process '
nRet = 0;
ItemReject( sMsg ) ;
EndIf;
EndIf;

Updated Code in Epilog,

If ( nError > 1 );
ProcessQuit;
EndIf;