Say I’ve got two scheduled processes: A and B.
Given that B should not run until A has completed, how might I gracefully enforce this dependency?
Approaches that have been considered:
-
Have A schedule B upon completion. This has the downside of B never being scheduled if for some reason A failed.
-
When B runs, have it ping A to see if the latter has completed. How this might be accomplished (network, file, database record, message queue) could be messy and problematic introducing a third dependency.
-
Combine A and B into a single process. This has the downside of tightly binding the two, making it harder to re-run one or the other in isolation if need be.
Thoughts?
Your option 1 directly answers your question: if B is dependent on A, and A fails, A not scheduling B means that B can’t happen.
Unless B merely has to run after A does, whether or not A was successful.
In that case, something like the following (in bash) would work: