Repository: incubator-airflow
Updated Branches:
refs/heads/master f3b6b60c4 -> 53e021cde
[AIRFLOW-2798] Remove needless code from models.py
If `email_on_failure` or `email_on_failure` set to
TRUE and email available, there will be email sent
out on event of retry or failure.
In the implementation, there is a argument
`is_retry` passed to method `self.email_alert`.
However, inside this method, this argument is not
used at all. I believer the initial author of this
method was planning to differentiate the email to
be sent out, but for whatever reason this was not
implemented.
Given in the email to be sent out, there will be a
line "Try {try_number} out of {max_tries}<br>", it
would be fine not to differentiate **retry email**
and **failure email**.
Closes #3640 from XD-DENG/patch-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/53e021cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/53e021cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/53e021cd
Branch: refs/heads/master
Commit: 53e021cde3502711d074988761a7de1eebbb5d6d
Parents: f3b6b60
Author: Xiaodong <[email protected]>
Authored: Wed Jul 25 19:09:38 2018 -0700
Committer: r39132 <[email protected]>
Committed: Wed Jul 25 19:09:41 2018 -0700
----------------------------------------------------------------------
airflow/models.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/53e021cd/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index 68a502d..d6a9199 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -1755,7 +1755,7 @@ class TaskInstance(Base, LoggingMixin):
self.state = State.UP_FOR_RETRY
self.log.info('Marking task as UP_FOR_RETRY')
if task.email_on_retry and task.email:
- self.email_alert(error, is_retry=True)
+ self.email_alert(error)
else:
self.state = State.FAILED
if task.retries:
@@ -1763,7 +1763,7 @@ class TaskInstance(Base, LoggingMixin):
else:
self.log.info('Marking task as FAILED.')
if task.email_on_failure and task.email:
- self.email_alert(error, is_retry=False)
+ self.email_alert(error)
except Exception as e2:
self.log.error('Failed to send email to: %s', task.email)
self.log.exception(e2)
@@ -1927,7 +1927,7 @@ class TaskInstance(Base, LoggingMixin):
rendered_content = rt(attr, content, jinja_context)
setattr(task, attr, rendered_content)
- def email_alert(self, exception, is_retry=False):
+ def email_alert(self, exception):
task = self.task
title = "Airflow alert: {self}".format(**locals())
exception = str(exception).replace('\n', '<br>')