Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have some jobs that run and currently it sends emails when the jobs fail. However, it sometimes sends a lot of emails if the job keeps failing for some time.
We are trying to reduce the number of emails by sending an initial email when the job fails then an email once it finally runs but not send an email for every successful job ran if it didn't fail.
My thought is storing the job id when the job fails and sends the failure email then once the job runs send another email and clear the job id.
I am not sure the best way to way to approach this or if it is possible.
Yes I agree with @shong.
In addition,I would also recommend to maintain an audit table to note these ID's as below
eg. Job_ID |Job_name | Last_run_TS | Run_Flag (Success/ Fail)
and keep 2 flows:
1. on component/subjob OK - Success notification
2. on component/subjob Error - failure notification
check / Update the table accordingly before sending notification.
In Detail:
Keep 1 record for each id (always update table)with some default value in run_flag(say NA), whenever a job completes (success or failure):
Success- update the record in table with corresponding run_flag and send success notification.
Failure- for first failure, update the run_flag as FAIL and send notification. For second failure, check if record already exists with run_flag as FAIL then don't send notification and go on.
Hi,
I would suggest to capture the details based on job name rather than id. That way, you can do the aggregation easily.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
your job scenario is not very clear, can you please elaborate the structure and then the email notification ask.
also are you running few jobs in sequence ?
is it coded to rerun till it get success?
Hi
Don't use iterate to trigger tsendmail for each input row, if you want the job to send email one time only when the job fails, use OnsubjobError connector to link tsendmail.
Regards
Shong
Yes I agree with @shong.
In addition,I would also recommend to maintain an audit table to note these ID's as below
eg. Job_ID |Job_name | Last_run_TS | Run_Flag (Success/ Fail)
and keep 2 flows:
1. on component/subjob OK - Success notification
2. on component/subjob Error - failure notification
check / Update the table accordingly before sending notification.
In Detail:
Keep 1 record for each id (always update table)with some default value in run_flag(say NA), whenever a job completes (success or failure):
Success- update the record in table with corresponding run_flag and send success notification.
Failure- for first failure, update the run_flag as FAIL and send notification. For second failure, check if record already exists with run_flag as FAIL then don't send notification and go on.