cancel
Showing results for 
Search instead for 
Did you mean: 

Lock Jobs in CPS

Former Member
0 Kudos

Hi,

Please help me in understanding of how LOCKS work in CPS ?

How can we configure lock between 2 jobs as they should not run simultaneously. Basically making these 2 different  jobs with different schedule dependent on each other, unless first job completes another one shouldn't start running and vise versa.

Regards,

Shwetha Houde

Accepted Solutions (1)

Accepted Solutions (1)

nanda_kumar21
Active Contributor
0 Kudos

To answer you question:

  • Create a lock in Definitions-->Locks,
    • add it to the job definition of both the jobs (Lock tab), and then schedule both jobs.
    • When one of the job is running, the lock is being used, hence the other job will wait for the lock to be free and will be rescheduled.

It is not recommended to use locks, because when there are more jobs waiting for the locks, as soon as the lock is free, one of the jobs will grab the lock and reschedule all the jobs again and this can performance issues as well.

If the two job are different jobs

  • You can either use a Job Chain Step 1 - Job A and Step 2 - Job B. Only when step 1 reaches final state, step 2 will start (or)
  • Create a queue with execution size of 1, and then reschedule both the jobs in that queue. In this case, any given time, the queue can execute only one job.

If its the same job - meaning that a job running every 5 minutes, takes 8 minutes to complete and you don't want the next occurrence of the job until the first one completed, then set the pre-submit count to 1, while submitting the job (in Time and Date screen)

Thanks

Nanda

Former Member
0 Kudos

Thanks Nanda for your quick reply, but in my scenario I would go for LOCK option , as I have only 2 different jobs for which I need to lock . One job which run at  12:00 am and another at 12:00pm . Unless the 12:00 am Job completes , 12:00 pm Job shouldn't start and vice versa .

Please confirm is it ok to use LOCK in this case and also below steps are correct one for using LOCK

1) Definition - Locks - Create Lock

2) Go to Job ( which runs at 12:00 am ) Edit - Lock tab - Mention this LOCK created.

3) Then to go to Job ( which run ay 12:00 pm ) Edit - Lock tab - Mention the same LOCK created.

Regards,

Shwetha Houde


gmblom
Active Contributor
0 Kudos

Hello,

Yes that is correct. Go ahead and use that.

Now i do not fully agree with the statement from Nanda that usage of Locks is not recommended. I want to nuance this a bit. If you want to force for a target application that no more than 1 job can be started at the same time: use a queue with limit 1. For the usage that Shwetha describes, this is where Locks are designed for.

Regards Gerben

nanda_kumar21
Active Contributor
0 Kudos

I stand corrected.

It is applicable for Shwetha current situation.

The recommendation i stated was when more number of jobs depending on the same lock.

Thanks

Nanda

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks a lot Gerben and Nanda for help , It really worked for me.

Regards,

Shwetha Houde