Skip to content

Commit

Permalink
cc_contact with email_sender variable
Browse files Browse the repository at this point in the history
  • Loading branch information
shincap8 committed Sep 6, 2024
1 parent d84f02e commit 34945a7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions backend/app/domain/services/base/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -135,7 +136,7 @@ def upload_model_to_s3_and_evaluate(
)
self.email_helper.send(
contact=user_email,
cc_contact="[email protected]",
cc_contact=self.email_sender,
template_name="model_upload_successful.txt",
msg_dict={"name": model_name},
subject=f"Model {model_name} upload succeeded.",
Expand Down Expand Up @@ -163,7 +164,7 @@ def upload_model_to_s3_and_evaluate(
)
self.email_helper.send(
contact=user_email,
cc_contact="[email protected]",
cc_contact=self.email_sender,
template_name="model_upload_successful.txt",
msg_dict={"name": model_name},
subject=f"Model {model_name} upload succeeded.",
Expand Down Expand Up @@ -371,7 +372,7 @@ def upload_prediction_to_s3(
)
self.email_helper.send(
contact=user_email,
cc_contact="[email protected]",
cc_contact=self.email_sender,
template_name="model_upload_successful.txt",
msg_dict={"name": model_name},
subject=f"Model {model_name} upload succeeded.",
Expand All @@ -390,15 +391,15 @@ def upload_prediction_to_s3(
if evaluate_model.status_code == 200:
self.email_helper.send(
contact=user_email,
cc_contact="[email protected]",
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.",
)
else:
self.email_helper.send(
contact=user_email,
cc_contact="[email protected]",
cc_contact=self.email_sender,
template_name="model_evaluation_failed.txt",
msg_dict={"name": model_name},
subject=f"Model {model_name} evaluation failed.",
Expand Down

0 comments on commit 34945a7

Please sign in to comment.