ajvb / kala

Modern Job Scheduler
MIT License
2.13k stars 187 forks source link

Support for jobs triggered on failure of other jobs (#140) #162

Closed itstehkman closed 6 years ago

itstehkman commented 6 years ago

Fixes #140. This PR allows you to define a job that gets triggered on failure of another job by setting OnFailureJob for a given Job. The test cases I've provided make sure that 1) this on failure job gets triggered on failure of the parent job 2) it does not get triggered when the parent job succeeds.

Some questions that may need to be answered and resolved are: 1) What happens if the on failure job gets triggered while it is already happening? Maybe we should specify a specific job type for on failure jobs only that disallows this? Or maybe we could just wait for the job to finish via its lock, and then run it when its done with its current run 2) How do you create these on failure jobs? Currently, I've shown via the test cases that you can add this job via the API, which may cause it to run on init depending on the schedule parameter. I do not feel like this is desired functionality, but I'll leave it up to you decide. I believe the desired functionality is that you create a job that never runs unless triggered on failure.

itstehkman commented 6 years ago

@ajvb my pleasure to help. This is an awesome project!

ajvb commented 6 years ago

@itstehkman Awesome! thanks a bunch