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