DAG Configuration
Overview
DAG (Directed Acyclic Graph) is a framework that has a collection of serialized jobs where each job is supposed to perform a certain task. You can use a DAG framework to specify an arbitrary order of execution of jobs without hardcoding it.
The following are the merits of using DAG job over batch job:
You can customize the query to fetch records and specify the same customized query in the Custom Query Class field while creating a job using the CL Loan UI. But, in a batch job, the query is customized only at the code level.
You can add, modify, or delete a job to the DAG framework using the CL Loan UI, whereas in a batch job, all these have to be performed at the code level.
You can customize the sequence in which the jobs run. For example, if there are three jobs with job IDs 1,2 and 3, it is not mandatory that the jobs run in a sequence of 1→ 2→ 3. This sequence can be customized.
Default DAGs
The CL Loan package provides the following DAGs by default:
Default Start of Day Dynamic Jobs With Locked Based ACH
Default Start of Day Dynamic Jobs
Default Start of Day Dynamic Jobs With Multiple Payment Mode Support
Default Start of Day Dynamic Jobs With Loan Diagnostics
Note:You can add any custom jobs to this default DAG or create your own custom DAG. See Set up a DAG Schedule.
Conditions
You can call any of the default DAGs, and the conditions recommended for calling them are listed in the following table:
Condition | The DAG Called |
---|---|
Multiple Payment Method Support = True | Default Start of Day Dynamic Jobs With Multiple Payment Mode Support |
Lock Based ACH = True | Default Start of Day Dynamic Jobs With Locked Based ACH |
Loan Diagnostics = True | Default Start of Day Dynamic Jobs With Loan Diagnostics |
Loan Diagnostics = False Multiple Payment Method Support = False Lock Based ACH = False | Default Start of Day Dynamic Jobs |
- These conditions are set in Custom Settings > Start of Day Job Chaining.
- To make DAG the default job, go to Setup > Custom Settings > Start of Day Job Chaining > Manage, and specify the DAG Name.
Set up a DAG Schedule
A DAG schedule is a template to run and prioritize the jobs and to set relationships among them.
For example, the Billing Job is required to run before the Payment Job. This can be set in the DAG Schedule, and based on the dependency, we can prioritize it.
Prerequisites
None.
Steps
Perform the following steps to set up a DAG schedule:
Create a DAG schedule.
Note:For details on how to create a DAG schedule, see Create a DAG Schedule.
Create jobs. These jobs are added to the DAG schedule.
Note:For details on how to create a job, see Create a Job.
Establish a sequence of jobs.
Note:For details on how to establish a sequence of the jobs, see Create a Job Dependency.
Create a DAG Schedule
Prerequisites
None.
Steps
Perform the following steps to create a DAG schedule:
Log in to your Salesforce account.
Click the App Launcher and search for
DAG Schedules
.On the DAG Schedules, click New.
Note:If your layout does not display the DAG Schedules tab, add it from the Setup. For more information on how to add a tab, see Create and Add a Tab (Navigation Item) to a Page.
On the New DAG Schedule page, specify the values of the fields as described in the following table, and then click Save:
Field Name Description DAG Name The DAG name. Cron ID An ID generated by the system once the DAG job runs. Cron Expression The DAG runs at the specified time, based on the values provided in this expression. The format, '20 30 8 10 2 ?', is read as Seconds, Minutes, Hours, Day_of_month, Month, Day_of_week. The DAG Schedule Details page is displayed with the details of the recently created DAG schedule as highlighted in the following image:
Create a Job
- You can create only one job at a time.
- Job dependencies can be created only after all the jobs are created.
Prerequisites
You must have an existing DAG-enabled batch job that is configured to run in the DynamicJobs framework.
If you do not have an existing DAG-enabled job, then you must create one. For more information on how to create a DAG-enabled batch job, see the Create a DAG-enabled Batch Job section.
Steps
Perform the following steps to create a job:
Log in to your Salesforce account.
Click the App Launcher.
Search for
DAG Schedules
, and click it.Note:If your layout does not display the DAG Schedules tab, add it from the Setup. For more information on how to add a tab, see Create and Add a Tab (Navigation Item) to a Page.
On the DAG Schedules page, select the required DAG.
On the DAG Schedule Related page, in the Jobs section, click New.
The New Job page is displayed as depicted in the following image:
On the New Job page, specify the values of the fields as described in the following table, and then click Save:
Field Name Description Autofield A unique ID generated for the DAG job. Batch Size
The number of records that can be processed in a batch.
Class The class that provides the job definition for running it through a DAG. The batch job must instantiate from this class to be run in the DAG.
Note:Namespace for the class must be specified while mentioning the class.
For more information on creating a new DAG class, see Create a DAG-enabled Batch Job section.
Fail Type The action taken by the system upon a job failure.
Note:Currently the system only does the logging of the error.
Label A unique job identifier.
You can provide the class name for it to be easily identifiable.
Number of Instances The number of instances of a job that are allowed to run in parallel.
Pipelined If this checkbox is selected, then the records are passed from one instance of a job to an instance of another job.
A pipelined job can have any number of child jobs but only one parent job.
Note:This is currently not recommended to be used for the existing loan packages.
User Query User query to fetch records. Abort Forcefully If this checkbox is selected, then only one instance of a job can run at a time. Multiple instances are automatically aborted. Custom Query It contains the custom query class name for the job to be run in a DAG.
Create a Job Dependency
After the jobs are created, you need to establish a relationship between them.
Prerequisites
None.
Steps
Perform the following steps to establish job dependencies:
Log in to your Salesforce account.
Go to App Launcher > DAG Schedules.
Note:If your layout does not display the DAG Schedules tab, then add it from the Setup. For more information on how to add a tab, see Create and Add a Tab (Navigation Item) to a Page.
On the DAG Schedule Detail page, in the Jobs Dependencies section, click New Job Dependency.
The New Job Dependency page is displayed, as depicted in the following image:
On the New Job Dependency page, specify the child-parent relationship fields between the jobs as explained in the following table, and then click Save:
Field Name Description Name A unique name ID generated for the DAG Job Dependency. DAG The DAG for which the relationships are created. Parent Job The name of the job that needs to be run before the child job.
Note:This field must be added to the page layout of New Job Dependency.
Child Job The name of the job that needs to be run after the parent job.
Run a DAG
You can run a DAG with the help of an API in the following way:
Execution of the APICopyclcommon.DynamicJobAPI6 apiHandle = clcommon.APIFactory.getDynamicJobAPI6();
apiHandle.runOnce(DagName);You can run a DAG from the CL Loan UI in the following way:
Log in to your Salesforce account.
Go to App Launcher > CL Loan.
Go to Servicing Configuration > Run DAG Jobs.
Select a job that you want to run and click Run Job.
Note:You can specify the Record IDs of the contracts for which you want to run the job. Parallelization does not work when the record ids are specified.
You can specify the Batch Size to override the batch size specified during the creation of the job.