Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Email if job fails then email once it finally runs

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.

 

0683p000009M7le.png

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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. 

 

View solution in original post

6 Replies
Anonymous
Not applicable
Author

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

 

Anonymous
Not applicable
Author

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?

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

Hopefully this is clearer. We are running a few jobs. Most of them run every 5 minutes. It is currently coded so it will try to run every 5 minutes and if it fails twice in a row it will send an email every 5 minutes until it runs successfully.

Example of first email it sends it:
Job ID is:
7

Job Desc:
Some job name

Overdue(minutes):
12

Then if it keeps failing every 5 minutes it will of course change the overdue time.
Anonymous
Not applicable
Author

Thank you, I believe this is what I am looking for and will give it a try. Then I just will need to send a successful email once it runs which I believe won't be too difficult.
Anonymous
Not applicable
Author

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.