Receive Email Notification

Get notified once your job is over.

Email Notification (Current User) for Job Completion

You can use the notify() method to send email notifications after completing a lengthy task. This helps keep you informed about the result of the operation.

For example, let's say you are running a process that takes a while to finish, like training a machine learning model. After it's done, you might want to receive an email letting you know whether it succeeded or encountered any issues.

Here's when you can use the notify method to notify users via email, which requires two pieces of information:

Title: This will be the subject line of the email.
Text: This will be the main content of the email.

This code snippet below demonstrates how to use the notify method to send email notifications based on the outcome of a long-running operation.

Sample Code

import markov

def execute_long_running_operation():
    # Long running job for example model training etc. 
    return None

try:
    outcome = execute_long_running_operation()
    # Triggers email notification
    markov.notify(title="Long running operation", text="Successfully completed operation")
except Exception as e:
    # Triggers email notification
    markov.notify(title="Long running operation", text="Failed to complete operation")

What’s Next