There are a couple of quick and dirty solutions that come to mind as possibilities, depending on the situation.
- It might work to put the failure notification on the job itself. That is going to depend partly on what you need in the notification and possibly on whether you're willing to have a specific notification configured in order to get it, whether you need the job to execute more tasks in the failure case, and whether I'm remembering correctly that if a "Wait X and retry Task N times" flow only fails the whole job if the task never succeeds.
- If the job is set not to start if it is already running, you could add a task before the one that allows retrying to set a job variable equal to the current number of executions of the task in question, and have an additional "on error" flow for the task with an "if other value" configuration so that it only runs if the task's current number of executions is the expected value for if it has just failed its last retry. This does require keeping track of the number of retries in two places though, I think, unless you do fancy things with the API instead of just using the built-in variable manipulation tasks.
- This is a bit more cluttered and complex, especially because you probably can't use your existing general-purpose notifications unless all you need to know is that the failure occurred and not many details about it...but it definitely ought to work: Add an extra task that either takes the place of the notification or serves only to fire it. Depending on your needs, you can do this a couple of different ways.
- I've had some jobs that might need to do something like this from more than one task, or where the failure condition required a multi-task cleanup process. In such a case, I put the "on failure" tasks all at the end of the job. Each task that needs the ability to jump to that logic has an "on failure" flow set with "if finally failing, go to Task" set to the first task of the "on failure" logic (or if I don't need it to retry, just a "go to task" flow) and "run following Tasks in order,", and the usual "on success" flow set to "continue to next task in order." Then the last task that is supposed to run if none of those error states are reached has an "on complete" flow set to "Stop Job." Alternatively, depending on the need - such as if you actually needed to run the rest of the regular tasks even in the case of failure for some reason - it could be set up with "If Other Value" so that it stops the job if none of the relevant tasks has failed, or continues into the failure steps if any of them have.
- If I just need to do one thing and stop in the case of failure, then I might make the failure task be the very next one, and have the "on success" flow skip it (that is, Go to Task <the next one that should run on success> and Run following Tasks in order), or just stop the job on success if the success case doesn't require any more tasks.
There are other, potentially more complex possibilities that can be strung together using parts of these techniques. I often prefer a task that takes the place of a notification if the notification would have to be specific to the task anyway, since otherwise I have a notification cluttering up my list that I can't actually use anywhere else.