Quantcast
Channel: SCN : Document List - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 401

Auto Rerun Mechanism for Batch Jobs

$
0
0


Business Scenario:-

The scheduled data services job(especially Rapid Mart)  fails with delta load due to data base connection timed out or occurrence of system resources’ dead lock.


Solution: -

Auto Rerunning of the same job with full load by triggering it from another scheduled job.

 

Data Services JOBS used for demonstration are as follows

 

Job Name

Description

Accounts_Receivable_Load_DIMS_20_SAP

Accounts Receivable Rapid mart with DELTA load

Accounts_Receivable_Load_DIMS_20_SAP_FULL_LOAD

Accounts Receivable Rapid mart with FULL load

Auto_Rerun

Customized Job with script to trigger FULL load whenever DELTA load fails.

 

Procedure:


  1. Created a project Auto_Rerun and added the above mentioned 2 rapid marts to the project.
  2. Created a Batch job with a workflow consisting of a script.
  3. Created two global variables $StatusOfJob(varchar) and $LatestJobTimestamp(varchar).
  4. Customized the script with the following code:-

#Recent job start time

$LatestJobTimestamp  = sql('Test_AutoRerun_DS','SELECT MAX(START_TIME) FROM dbo.ALVW_HISTORY WHERE SERVICE=\'Accounts_Receivable_Load_DIMS_20_SAP\';');

PRINT('********************************************************************************************************');

PRINT('Recent timestamp of Job Accounts_Receivable_Load_DIMS_20_SAP is '||$LatestJobTimestamp);

#Recent status

$StatusOfJob  = sql('Test_AutoRerun_DS','SELECT STATUS FROM dbo.ALVW_HISTORY WHERE SERVICE=\'Accounts_Receivable_Load_DIMS_20_SAP\' AND START_TIME=\'[$LatestJobTimestamp]\';');

PRINT('Status Of the JOB Accounts_Receivable_Load_DIMS_20_SAP is  '||$StatusOfJob);

if ($StatusOfJob='E')

begin

Print('Job Accounts_Receivable_Load_DIMS_20_SAP had failed ');

Print('Rerunning the job Accounts_Receivable_Load_DIMS_20_SAP ......... ');

exec('C:\ProgramData\SAP BusinessObjects\Data Services\log\Accounts_Receivable_Load_DIMS_20_SAP_FULL_LOAD.bat','',8);

PRINT('********************************************************************************************************');

end

else

begin

print('Job Accounts_Receivable_Load_DIMS_20_SAP had Successfully executed');

PRINT('****************************************************************************');

end

01.JPG

 

5.Executed the job Accounts_Receivable_Load_DIMS_20_SAP (DELTA load):

 

02.JPG

 

6.Executed the job Auto_Rerun:


03.JPG


Since the DELTA load did not fail, the script did not trigger FULL load job.

 

7.Removed one of the mappings of query transform for DELTA load (to fail the execution):

 

04.JPG

 

8.Saved and executed the job with DELTA load: (DELTA load failed)

 

05.JPG

 

9.Executed the job Auto_Rerun:

 

06.JPG

 

Since the DELTA load failed, the script triggered FULL load job.

 

 

Central Management Console:

 

07.JPG

 

Summary:

  • The JOB Accounts_Receivable_Load_DIMS_20_SAP which has DELTA load is scheduled as per the client’s schedule.
  • The Job Auto_Rerun is scheduled after around an hour (compared to the scheduled time of DELTA load).
  • Hence, if the DELTA job runs successfully then the Auto_Rerun job gets the status from the default repository view (dbo.ALVW_HISTORY) and as per the “if” condition mentioned, it does not trigger the FULL load.
  • But when the DELTA load fails, the Auto_Rerun job gets the status from the default repository view (dbo.ALVW_HISTORY) and as per the “if” condition mentioned, it triggers the FULL load which indeed will avoid the data base connectivity or any other resource issues and data is successfully loaded into the target.

 

Regards,

Mubashir Hussain


Viewing all articles
Browse latest Browse all 401

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>