Batch Dependencies

105 views
Skip to first unread message

Robert Compton

unread,
Sep 30, 2014, 4:59:48 AM9/30/14
to sche...@googlegroups.com
Good Morning group,
  I have a question that has been bugging me for some time.

  Is it possible to have dependencies between batches?  I need Batch2 to start running only when Batch1 is complete.  It's easy to do this at the job level but I've never been able to do it at the batch level.  Scanning the documentation has not yielded any solutions - perhaps I missed something.

  Regards

Rob

Ronald Jeninga

unread,
Sep 30, 2014, 5:27:19 AM9/30/14
to sche...@googlegroups.com
Hi Rob,

good to hear from you again :-)

Actually we regard the possibility of creating dependencies between batches (or jobs and batches) as one of the powerful features of the system.
The effect is that there will be implicit dependencies between the "contents".
This means, if you have a batch b1 with children c11 and c12, and a batch b2 with children c21 and c22, creating a dependency between b1 and b2 (b2 runs if b1 has reached a final state), will have the same effect as defining 4 dependencies between the jobs (c11->c21, c11->c22, c12->c21, c12->c22).

In short: Yes, it is possible. (if you still have the examples installed, look at E0025_BATCH_HIERARCHY)

What did you try so far?
you can either use the hierarchy display and "chain" the batches, or copy the required batch and paste it in the dependencies tab of the dependent batch.

Hope this helps.

Regards,

Ronald

Robert Compton

unread,
Sep 30, 2014, 8:37:26 AM9/30/14
to sche...@googlegroups.com
Hi Ronald,
  Thanks for pointing me to the example.  My error was not creating a top level batch into which the child batches can be placed.  I was simply trying to set Batch2 run on the success of Batch1 by using the dependencies tab.

  I've run a few test on dummy batches and they now run in the expected order.

  I've now added some of my production batches to a top level batch and have set the hierarchy so they will run in the order I want them to.  Fingers crossed that my DB backup & restore batches now run overnight with their new inter-batch dependencies.

  Many thanks

Rob

Ronald Jeninga

unread,
Sep 30, 2014, 9:40:51 AM9/30/14
to sche...@googlegroups.com
Hi Rob,

ok, dependencies don't work for unrelated batches, which is somehow logical, I think. In order to synchronize unrelated batches, you use synchronizing resources.

As an example, you want to do some reporting and a database backup over night. It is obvious that both actions aren't related, at least not logically. But it is very well possible that reporting would slow down the backup and vice versa. So if they run in parallel, the total time required would exceed the time required if they would be serialized.
In this case you'd definitely choose synchronizing resources. You create a resource that mirrors some database. The reporting job would allocate the resource with shared lock, the backup with exclusive lock. This guarantees that they don't run in parallel.

In case of backup and restore (e.g. you make a backup of the production database and restore it in a test/QA environment) both processes are logically related. You can't restore a not yet existing backup. Now you have a choice. You can either put them together into some common parent batch and create a dependency, or you make use of synchronizing resources again. In the latter case you'll need a resource with a state model and either test for actuality (expiration) in the restore job, or toggle the state between the two batches (IS_BACKUPED <-> IS_RESTORED). (In this specific example, I'd test for actuality).
The good question in this case is: who's responsible? If two different departments are responsible, I'd choose the resource solution. If it's all in one hand, why make it more complicated than necessary?

Welcome :-)

Ronald

PS. A third possibility just came to mind. The backup batch could trigger the restore batch as a master (top level) batch. But I think that's a bit obscure. Using resources or dependencies is a better way to describe the situation.
Reply all
Reply to author
Forward
0 new messages