From 34945a700f4ced1f4f0df88c22ece00c816f174d Mon Sep 17 00:00:00 2001 From: Sara H Date: Fri, 6 Sep 2024 13:42:00 -0500 Subject: [PATCH] cc_contact with email_sender variable --- backend/app/domain/services/base/model.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/app/domain/services/base/model.py b/backend/app/domain/services/base/model.py index 5f37fa16..a50df2fc 100644 --- a/backend/app/domain/services/base/model.py +++ b/backend/app/domain/services/base/model.py @@ -74,6 +74,7 @@ def __init__(self): "openaihm": OpenAIProvider(task_id=56), "coherehm": CohereProvider(task_id=56), } + self.email_sender = os.getenv("MAIL_LOGIN") def get_model_in_the_loop(self, task_id: str) -> str: model_in_the_loop_info = self.model_repository.get_model_in_the_loop(task_id) @@ -135,7 +136,7 @@ def upload_model_to_s3_and_evaluate( ) self.email_helper.send( contact=user_email, - cc_contact="dynabench-site@mlcommons.org", + cc_contact=self.email_sender, template_name="model_upload_successful.txt", msg_dict={"name": model_name}, subject=f"Model {model_name} upload succeeded.", @@ -163,7 +164,7 @@ def upload_model_to_s3_and_evaluate( ) self.email_helper.send( contact=user_email, - cc_contact="dynabench-site@mlcommons.org", + cc_contact=self.email_sender, template_name="model_upload_successful.txt", msg_dict={"name": model_name}, subject=f"Model {model_name} upload succeeded.", @@ -371,7 +372,7 @@ def upload_prediction_to_s3( ) self.email_helper.send( contact=user_email, - cc_contact="dynabench-site@mlcommons.org", + cc_contact=self.email_sender, template_name="model_upload_successful.txt", msg_dict={"name": model_name}, subject=f"Model {model_name} upload succeeded.", @@ -390,7 +391,7 @@ def upload_prediction_to_s3( if evaluate_model.status_code == 200: self.email_helper.send( contact=user_email, - cc_contact="dynabench-site@mlcommons.org", + cc_contact=self.email_sender, template_name="model_evaluation_sucessful.txt", msg_dict={"name": model_name, "model_id": model["id"]}, subject=f"Model {model_name} evaluation succeeded.", @@ -398,7 +399,7 @@ def upload_prediction_to_s3( else: self.email_helper.send( contact=user_email, - cc_contact="dynabench-site@mlcommons.org", + cc_contact=self.email_sender, template_name="model_evaluation_failed.txt", msg_dict={"name": model_name}, subject=f"Model {model_name} evaluation failed.",