-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a pretty template with the success email
- Loading branch information
1 parent
2959ee9
commit 4fea2f5
Showing
2 changed files
with
233 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,10 +45,9 @@ def email_submission_to_admin(sender_email, admin_email): | |
"__Private_Parameters": ["send_credentials"], | ||
}, | ||
"ResultPath": "$.EmailSubmissionResult", | ||
"Next": "Check Metadata Only" | ||
}, | ||
} | ||
|
||
"Next": "Check Metadata Only", | ||
}, | ||
} | ||
|
||
|
||
def check_update_metadata_only(): | ||
|
@@ -63,7 +62,7 @@ def check_update_metadata_only(): | |
"Next": "ChooseCuration", | ||
} | ||
], | ||
"Default": "CreateDestinationDir", | ||
"Default": "CreateDatasetDir", | ||
} | ||
} | ||
|
||
|
@@ -77,20 +76,37 @@ def file_transfer_steps(): | |
* Remove the temporary write permission | ||
""" | ||
return { | ||
"CreateDestinationDir": { | ||
"Comment": "Create a destination directory for the transfered data", | ||
"CreateDatasetDir": { | ||
"Comment": "Insure the dataset directory exists before attempting to create the version subdirectory", | ||
"Type": "Action", | ||
"ActionUrl": "https://actions.globus.org/transfer/mkdir", | ||
"ExceptionOnActionFailure": False, | ||
"Parameters": { | ||
"endpoint_id.$": "$.user_transfer_inputs.destination_endpoint_id", | ||
"path.$": "$.user_transfer_inputs.dataset_path", | ||
}, | ||
"ResultPath": "$.CreateDatasetDirResult", | ||
"Next": "CreateDestinationDir", | ||
}, | ||
"CreateDestinationDir": { | ||
"Comment": "Create a destination directory for the transferred data", | ||
"Type": "Action", | ||
"ActionUrl": "https://actions.globus.org/transfer/mkdir", | ||
"ExceptionOnActionFailure": True, | ||
"Parameters": { | ||
"endpoint_id.$": "$.user_transfer_inputs.destination_endpoint_id", | ||
"path.$": "$.user_transfer_inputs.transfer_items[0].destination_path", | ||
}, | ||
"ResultPath": "$.CreateDestinationDirResult", | ||
"Catch": [ | ||
{ | ||
"ErrorEquals": ["ActionFailedException", "States.Runtime"], | ||
"Next": "FailUserPermission", | ||
"ErrorEquals": [ | ||
"ActionFailedException", | ||
"States.Runtime", | ||
"EndpointError", | ||
], | ||
"ResultPath": "$.CreateDestinationDirResult", | ||
"Next": "ExceptionState", | ||
} | ||
], | ||
"Next": "UserPermissions", | ||
|
@@ -111,8 +127,13 @@ def file_transfer_steps(): | |
"ResultPath": "$.UserPermissionResult", | ||
"Catch": [ | ||
{ | ||
"ErrorEquals": ["ActionFailedException", "States.Runtime"], | ||
"Next": "FailUserPermission", | ||
"ErrorEquals": [ | ||
"ActionFailedException", | ||
"States.Runtime", | ||
"EndpointError", | ||
], | ||
"ResultPath": "$.UserPermissionResult", | ||
"Next": "ExceptionState", | ||
} | ||
], | ||
"Next": "UserTransfer", | ||
|
@@ -145,8 +166,13 @@ def file_transfer_steps(): | |
"ResultPath": "$.UndoUserPermissionResult", | ||
"Catch": [ | ||
{ | ||
"ErrorEquals": ["ActionFailedException", "States.Runtime"], | ||
"Next": "FailUserPermission", | ||
"ErrorEquals": [ | ||
"ActionFailedException", | ||
"States.Runtime", | ||
"EndpointError", | ||
], | ||
"ResultPath": "$.UndoUserPermissionResult", | ||
"Next": "ExceptionState", | ||
} | ||
], | ||
"Next": "CheckUserTransfer", | ||
|
@@ -160,25 +186,7 @@ def file_transfer_steps(): | |
"Next": "ChooseCuration", | ||
} | ||
], | ||
"Default": "FailUserTransfer", | ||
}, | ||
"FailUserTransfer": { | ||
"Type": "ExpressionEval", | ||
"Parameters": { | ||
"title": "MDF Submission Failed", | ||
"message.=": "'Your MDF submission ' + `$.source_id` + ' failed during transfer, please try again or contact [email protected]:\n' + `$.UserTransferResult.details`", | ||
}, | ||
"ResultPath": "$.FinalState", | ||
"Next": "NotifyUserEnd", | ||
}, | ||
"FailUserPermission": { | ||
"Type": "ExpressionEval", | ||
"Parameters": { | ||
"title": "MDF Permission Settings Failed", | ||
"message.=": "'Your MDF submission ' + `$.source_id` + ' failed to transfer, please try again or contact [email protected]:\n' + `$.UserPermissionResult.details`", | ||
}, | ||
"ResultPath": "$.FinalState", | ||
"Next": "NotifyUserEnd", | ||
"Default": "ExceptionState", | ||
}, | ||
} | ||
|
||
|
@@ -283,10 +291,10 @@ def curation_steps(sender_email, admin_email): | |
"Type": "ExpressionEval", | ||
"Parameters": { | ||
"title": "MDF Submission Rejected", | ||
"message.=": "'Your submission (' + `$.source_id` + ') was rejected by a curator and did not complete the publication process. The curator gave the following reason: '+ `$.CurateResult.details.output.CurationResult.details.parameters.user_input`", | ||
"message.=": "'Your submission (' + `$.dataset_mdata.mdf.versioned_source_id` + ') was rejected by a curator and did not complete the publication process. The curator gave the following reason: '+ `$.CurateResult.details.output.CurationResult.details.parameters.user_input`", | ||
}, | ||
"ResultPath": "$.FinalState", | ||
"Next": "NotifyUserEnd", | ||
"Next": "ExceptionState", | ||
}, | ||
} | ||
|
||
|
@@ -363,7 +371,7 @@ def search_ingest_steps(): | |
} | ||
|
||
|
||
def notify_user_steps(sender_email): | ||
def notify_user_steps(sender_email, email_template): | ||
""" | ||
Check on the final status of the submission and notify the submitting user as | ||
appropriate | ||
|
@@ -383,10 +391,18 @@ def notify_user_steps(sender_email): | |
"ActionUrl": action_providers.notify, | ||
"ExceptionOnActionFailure": True, | ||
"Parameters": { | ||
"body_template.$": "$.FinalState.message", | ||
"body_mimetype": "text/html", | ||
"body_template": email_template, | ||
"body_variables": { | ||
"greeting.$": "$.dataset_mdata.dc.creators[0].givenName", | ||
"contributors.$": "$.creators_list", | ||
"title.$": "$.dataset_mdata.dc.titles[0].title", | ||
"year.$": "$.dataset_mdata.dc.publicationYear", | ||
"doi.$": "$.dataset_mdata.dc.identifier.identifier" | ||
}, | ||
"destination.$": "$.submitting_user_email", | ||
"sender": sender_email, | ||
"subject.$": "$.FinalState.title", | ||
"subject": "Dataset Accepted for Publication in the Materials Data Facility", | ||
"send_credentials": [ | ||
{ | ||
"credential_method": "email", | ||
|
@@ -417,7 +433,16 @@ def exception_state(sender_email): | |
"sender": sender_email, | ||
"destination.$": "$.submitting_user_email", | ||
"subject": "Submission Failed to Ingest", | ||
"body_template.=": "'Submission ' + `$.source_id` + ' fatally errored processing in Flow '+ `$._context.action_id` + '. Please review the Flow log for details about this exception.'", | ||
"body_template": """ | ||
<html><h1>Submission Failed to Ingest</h1> | ||
"Submission: $source_id received a fatal error while processing flow. | ||
Please review the <a href="https://app.globus.org/runs/$flow_log_link/logs"> Flow log </a> for details about this exception. | ||
</html> | ||
""", | ||
"body_variables": { | ||
"source_id.$": "$.dataset_mdata.mdf.source_id", | ||
"flow_log_link.$": "$._context.run_id", | ||
}, | ||
"notification_method": "any", | ||
"notification_priority": "high", | ||
"send_credentials": [ | ||
|
@@ -431,7 +456,7 @@ def exception_state(sender_email): | |
}, | ||
"ResultPath": "$.ExceptionNotifyResult", | ||
"WaitTime": 86400, | ||
"Next": "NotifyUserEnd", | ||
"Next": "EndSubmission", | ||
}, | ||
} | ||
|
||
|
@@ -443,6 +468,11 @@ def flow_def( | |
administered_by, | ||
description="", | ||
): | ||
# The success email is a nicely formatted html message. Read that from this file to make format testing easier | ||
with open("success_email_template.html", "r") as f: | ||
email_template = f.read() | ||
|
||
|
||
return GlobusAutomateFlowDef( | ||
title="MDF Ingest Flow", | ||
subtitle="Ingest Materials Data Facility Submissions", | ||
|
@@ -461,7 +491,7 @@ def flow_def( | |
**curation_steps(sender_email, admin_email), | ||
**mint_doi_steps(), | ||
**search_ingest_steps(), | ||
**notify_user_steps(sender_email), | ||
**notify_user_steps(sender_email, email_template), | ||
**exception_state(sender_email), | ||
"EndSubmission": {"Type": "Pass", "End": True}, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
<div style="display: flex;justify-content: center"> | ||
<table style="width: 600px"> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<img alt="" width="230" | ||
style="display:block;border:0;outline:none" | ||
src="https://materialsdatafacility.org/static/img/MDF-logo%402x.png"> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<h3 style="margin:0;line-height:22px;font-size:18px;color:rgb(51,51,51);text-align:left"> | ||
$greeting,</h3></td> | ||
</tr> | ||
<tr> | ||
<td style="padding:5px 0"><p | ||
style="margin:0;line-height:21px;color:rgb(51,51,51);font-size:14px"> | ||
Thank you for your contribution to the Materials Data Facility, | ||
and towards open science. Your dataset has been published with | ||
the | ||
following information.</p> | ||
<p style="margin:0;line-height:21px;color:rgb(51,51,51);font-size:14px"> | ||
best,</p> | ||
<p style="margin:0;line-height:21px;color:rgb(51,51,51)"> | ||
<b>Ben</b> | ||
</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<table style="border-spacing:0;border:2px solid rgb(92,104,226);border-radius:5px"> | ||
<tbody> | ||
<tr> | ||
<td style="padding:20px 20px 0"> | ||
<h2 style="margin:0;line-height:31px;font-size:26px;color:rgb(51,51,51)"> | ||
Your Dataset Citation Information</h2> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="padding:10px 20px 20px"> | ||
<h1 style="margin:0;line-height:18px;font-size:15px;color:rgb(51,51,51);text-align:left"> | ||
<span style="font-weight:400;color:rgb(52,73,94);font-family:Helvetica,Arial,sans-serif;font-size:18px"><br></span> | ||
</h1> | ||
<span style="font-weight:400;color:rgb(52,73,94);font-family:Helvetica,Arial,sans-serif;font-size:18px"> | ||
$contributors. "$title." Materials Data Facility, $year. | ||
</span><a href="https://doi.org/$doi" | ||
style="font-weight:400;box-sizing:border-box;color:rgb(52,152,219);text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:18px" | ||
target="blank"> | ||
https://doi.org/$doi</a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div style="text-align: center"> | ||
<a href="https://doi.org/$doi" | ||
style="color:rgb(255,255,255); | ||
background-color:rgb(92,104,226);text-decoration:none; | ||
font-size:20px;border-style:solid;border-color:rgb(92,104,226);border-width:10px 30px; | ||
display:inline-block;border-radius:6px;line-height:24px;width:auto" | ||
target="_blank">Your Data Link</a> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="padding:15px 20px 5px 0"> | ||
<h2 style="margin:0;line-height:31px;font-size:26px;color:rgb(51,51,51);text-align:left"> | ||
Citing MDF</h2> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="padding:0"><p | ||
style="margin:0;line-height:24px;color:rgb(92,104,226);font-size:16px"> | ||
<strong>You can help us build support for MDF by citing | ||
the papers below. </strong></p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="padding:10px 20px"> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td style="padding:0;width:560px"> | ||
<ul> | ||
<li style="line-height:21px;margin-bottom:15px;margin-left:0;color:rgb(51,51,51);font-size:14px"> | ||
<p style="margin:0;line-height:21px"> | ||
Blaiszik, B., K. Chard, J. Pruyne, R. | ||
Ananthakrishnan, S. Tuecke, and I. | ||
Foster. | ||
"The Materials Data Facility: Data | ||
Services to | ||
Advance Materials Science Research." JOM | ||
68, no. | ||
8 (July 6, 2016): | ||
2045-2052. | ||
doi:10.1007/s11837-016-2001-3.</p> | ||
</li> | ||
<li style="line-height:21px;margin-bottom:15px;margin-left:0;color:rgb(51,51,51);font-size:14px"> | ||
<p style="margin:0;line-height:21px"> | ||
Blaiszik, Ben, Logan Ward, Marcus | ||
Schwarting, | ||
Jonathon Gaff, Ryan Chard, Daniel Pike, | ||
Kyle | ||
Chard, and | ||
Ian Foster. "A Data Ecosystem to Support | ||
Machine | ||
Learning in | ||
Materials Science." MRS Communications | ||
(October | ||
10, 2019): 1-9. | ||
doi:10.1557/mrc.2019.118.</p> | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:20px;font-size:0"> | ||
<table role="presentation" | ||
style="border-collapse:collapse;border-spacing:0"> | ||
<tbody> | ||
<tr> | ||
<td style="padding:0;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204); | ||
background-image:unset;background-size:unset;background-origin:unset;background-clip:unset; | ||
height:1px;width:520px;background-position:unset;background-repeat:unset"></td> | ||
</tr> | ||
|
||
<tr style="text-align: center"> | ||
<td style="padding:10px 0"> | ||
<span style="border:0 solid rgb(44,181,67);background-color:rgb(92,104,226);display:inline-block;border-radius:6px;width:auto"> | ||
<a | ||
href="https://www.materialsdatafacility.org" | ||
style="color:rgb(255,255,255);text-decoration:none;font-size:20px;border-style:solid;border-color:rgb(92,104,226); | ||
border-width:10px 30px;display:inline-block;border-radius:6px;line-height:24px;width:auto" | ||
target="_blank"> | ||
Publish More Data</a></span></td> | ||
</tr> | ||
<tr> | ||
<td style="padding:0"> | ||
<h2 style="margin:0;line-height:18px;font-size:15px;color:rgb(51,51,51);text-align:center"> | ||
Questions? Contact | ||
<a href="mailto:[email protected]" | ||
target="_blank"> | ||
[email protected] | ||
</a> | ||
</h2> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> |