Notifications¶
When a run finishes in Domino, by default you will be notified of failed project runs by email. You and your project collaborators can also choose to receive notifications of successful runs. On successful runs, you will receive an email with the last few lines of stdout, and up to 10 Results files from your run (Domino will detect which files have been added or changed during your run, and will capture those as the run’s Results).
You may edit your notification preferences in the project collaborators tab:
Custom Notifications¶
If you’d like to format your own success email to display your figures
with more context, create a file named email.html
in the root of your project folder as part of your run. The HTML will be used as
the body of the email sent on success.
Tips and tricks:
- Include images by referencing the path to the image from the root of
the folder (the image can be anywhere in your project). For instance,
to include an image written to
plots/plot1.png
you would write<img src="plots/plot1.png">
. - Put all CSS styles in inline
style
attributes. Most email clients ignore<style>
blocks in HTML emails. - If you want to do complex layout, use tables. Most email clients ignore CSS positioning.
- You can customize the subject by including a
<head>
tag at the start of the file.<head><title>Custom Title</title></head>
will result in an email with the subject “[Domino] Custom Title”. Be sure to include the<title>
tags as well. - If you would like to explicitly define the files that are sent with
your success email, create a file named
.dominoresults
and write each filename per line in the.dominoresults
file.
For example, here is an R script and the resulting email:
# generate and save plot
png("pressure.png")
plot(pressure)
dev.off()
# generate HTML in a string
html_string <- paste0("
<head>
<title>",Sys.Date()," - Pressure report","</title>
</head>
<body>
<h2>Exponential pressure growth! </h2>
<h3>",Sys.time(),"</h3>
<img src='pressure.png' />
<p>Caption goes here</p>
</body>
")
# write string to file
write(html_string, "email.html")
Python example:
import matplotlib.pyplot as plt
import numpy as np
x = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8])
y = np.array([495, 620, 761.88, 899.8, 1039.93, 1270.63, 1589.04, 1851.31, 2154.92])
plt.axis([0, 8, 0, 2200])
plt.xlabel('year')
plt.ylabel('balance')
plt.plot(x, y)
plt.savefig('results/plot.png')
email_content = """
<head>
<title>Latest projections</title>
</head>
<body>
<h1>Latest projections</h1>
<div>
<img src="results/plot.png">
</div>
</body>
"""
f = open('email.html', 'w')
f.write(email_content)
f.close()