Search code examples
jobscyclecontrol-m

Control-M: cyclic children jobs


I have a Ctrl-M workflow of 3 Jobs that are supposed to run every 15 minutes as follows:

Job1-->Job2-->Job3.

Schedule is from 9am to 11am, cyclic every 15 minutes.

Control-M version V9.

Business rule: Job1 starts. As soon as Job1 is completed successfully, Job2 has to start. As soon as Job2 is completed successfully, Job3 has to start.

Therefore what I did is to define Job1 cyclic every 15 minutes and a create a out condition "job1-OK" that is a precondition for Job2, and the same from Job2 to Job3.

I found that if you don't define Job2 and Job3 as cyclic too, they are never ever kicked of again after their first execution. Do you know guys why? what I did to solve this problem is to set Job2 and Job3 cyclic every 15 minutes too, but this makes my "Workflow" < Job1-->Job2-->Job3 > to be messed up because the 15 minutes condition of Job2 is evaluated before my parent Job1 has completed, therefore Job2 never runs if Job1 "cycle" is not in sync with Job2 cycle. Do you know what I mean?

Example: Job1 runs in 1 minute, Job1-OK out condition is released and Job2 is kicked off, same from Job2 to Job3. Job1 is now waiting for the next 15 mins cycle, the cycle is hit, it runs and takes 20 minutes run: In parallel, Job2 is waiting for the 15 mins cycle + the out condition from Job1: As soon as the 15 mins cycle of job2 is hit, the pre-condition from Job1 is evaluated, returns false (because Job1 is still running) and Job2 goes to wait condition for the next 15 minutes cycle + Job1-OK out condition required to run Job2. Job1 is completed in 18 minutes and releases "Job1-OK" condition BUT Job2 is not kicked off because the next cycle will happen within the next 12 minutes because Job1 took 18 minutes to run. Therefore, Job2 execution is lost in this cycle.

i basically want Job2 to run as soon as Job1 is completed, no matter schedule, time, cycle or whatever. Is it possible to accomplish such a task? Otherwise, how can I fulfill such requirement without overlapping between cycles and pre-conditions check?

Thanks a lot, I hope I explained myself properly!


Solution

  • After a long research, figured it out:

    • Ctrl-M needs all jobs to be cyclic if you want them to run multiple times: you can not relay just on a pre-condition only to run multiple times the same day
    • The only way to control when a job has to be kicked-off again is to play around with specific in-out conditions for the jobs workflow, as well as quantitative and control resources (no more than X jobs running at the same time, etc..)

    ALTERNATIVE: A good alternative to not have cyclic jobs is to order children jobs "on the fly" as soon as the condition to kick-off the child job is fulfilled: this way there is no need to create tons of out conditions, just order the job when is supposed to be kicked-off by the parent!! In addition, to support complex workflows with multiple scenarios, you can create some dummy jobs to check for pre-conditions that will be evaluated cyclic too, every 1 minute for example.