0

I have a Python script that calls an API to fetch information about the job runs we have on IDMC from Informatica. The data queried from the API contains the runID, runName, Status and dates.

I want to have a framework where I can get notified via email in case of a job failure (Status = 'Failed' or 'Suspended').

Unfortunately, it's not possible, due to internal issues, to set an email notification from IDMC directly in case of a job failure, hence, I developed this Python query.

How can I do that? Given that we have a pipeline on Azure DevOps that runs the script on a daily schedule.

Any help would be much appreciated!

1 Answer 1

1

use pip install yagmail:

example:

import yagmail
yag = yagmail.SMTP(user="[email protected]", 
password="your_email_password")
yag.send("[email protected]", "Subject", "Hello, this is a test 
email from Python.")

the code is pretty self explaintory but If you have any questions let me know

Sign up to request clarification or add additional context in comments.

8 Comments

you will have to have its own email address but it should work
Thank you for your answer! But this doesn't really serve my goal, I need to trigger the email in case the Status is either 'Failed' or 'Suspended' in the df returned by the API
My bad, I thought you were just struggling to send the email in the first place
do you think you could put it nin an "if" statement and just check if the sattus is failed or suspended?
This is a perectly valid answer, Abdel. Please give this a try, test and share the result in case you'd face issues. The code shared here will send the email.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.