|
@@ 86-109 (lines=24) @@
|
| 83 |
|
@staticmethod |
| 84 |
|
def __send_mail_schedule_node_failed(rnd_id): |
| 85 |
|
""" |
| 86 |
|
Sends a mail to operators that a schedule has terminated unsuccessfully. |
| 87 |
|
|
| 88 |
|
:param int rnd_id: The ID of the schedule. |
| 89 |
|
""" |
| 90 |
|
node = DataLayer.enk_back_run_node_get_details(rnd_id) |
| 91 |
|
operators = DataLayer.enk_back_get_operators() |
| 92 |
|
|
| 93 |
|
if operators: |
| 94 |
|
body = """Dear Enarksh operator, |
| 95 |
|
|
| 96 |
|
Schedule {} finished unsuccessfully. |
| 97 |
|
|
| 98 |
|
Greetings from Enarksh""".format(str(node['sch_name'], 'utf-8')) |
| 99 |
|
|
| 100 |
|
subject = "Schedule {} finished unsuccessfully".format(str(node['sch_name'], 'utf-8')) |
| 101 |
|
|
| 102 |
|
to = [] |
| 103 |
|
for operator in operators: |
| 104 |
|
to.append(operator['usr_email']) |
| 105 |
|
|
| 106 |
|
MailOperatorEventHandler.__send_mail(to, subject, body) |
| 107 |
|
|
| 108 |
|
# ------------------------------------------------------------------------------------------------------------------ |
| 109 |
|
@staticmethod |
| 110 |
|
def __send_mail_schedule_node_success(rnd_id): |
| 111 |
|
""" |
| 112 |
|
Sends a mail to operators that a schedule has terminated successfully. |
|
@@ 60-83 (lines=24) @@
|
| 57 |
|
@staticmethod |
| 58 |
|
def __send_mail_simple_node_failed(rnd_id): |
| 59 |
|
""" |
| 60 |
|
Sends a mail to operators that a simple node has terminated with an error. |
| 61 |
|
|
| 62 |
|
:param int rnd_id: The ID of the run node. |
| 63 |
|
""" |
| 64 |
|
node = DataLayer.enk_back_run_node_get_details(rnd_id) |
| 65 |
|
operators = DataLayer.enk_back_get_operators() |
| 66 |
|
|
| 67 |
|
if operators: |
| 68 |
|
body = """Dear Enarksh operator, |
| 69 |
|
|
| 70 |
|
Job {} has run unsuccessfully. |
| 71 |
|
|
| 72 |
|
Greetings from Enarksh""".format(str(node['uri_uri'], 'utf-8')) |
| 73 |
|
|
| 74 |
|
subject = "Job of schedule {} failed".format(str(node['sch_name'], 'utf-8')) |
| 75 |
|
|
| 76 |
|
to = [] |
| 77 |
|
for operator in operators: |
| 78 |
|
to.append(operator['usr_email']) |
| 79 |
|
|
| 80 |
|
MailOperatorEventHandler.__send_mail(to, subject, body) |
| 81 |
|
|
| 82 |
|
# ------------------------------------------------------------------------------------------------------------------ |
| 83 |
|
@staticmethod |
| 84 |
|
def __send_mail_schedule_node_failed(rnd_id): |
| 85 |
|
""" |
| 86 |
|
Sends a mail to operators that a schedule has terminated unsuccessfully. |