huozhanfeng commented on a change in pull request #16768:
URL: https://github.com/apache/airflow/pull/16768#discussion_r663636682
##########
File path: airflow/models/taskinstance.py
##########
@@ -1495,8 +1495,7 @@ def handle_failure(
except Exception:
self.log.exception('Failed to send email to: %s', task.email)
- if not test_mode:
- session.merge(self)
+ session.merge(self)
Review comment:
@uranusjr Find the one. Looks like it's related to the airflow test
command. In the lasted UT, UT will raise `IndexError: list index out of range`
with the code block `assert tis[0].hostname == "test_hostname"` if remove this
change.
I wonder whether it is reasonable to mix UT and test commands together here
by using a test_mode variable because the test command doesn't want to save the
state into DB/session but UT should save the state into DB/session. Do you have
any idea about it?
<pre>
commit aa01fab4906df3175e5e6589ec0095a5586279db
Author: Maxime Beauchemin <[email protected]>
Date: Mon Jan 12 21:54:40 2015 +0000
Improving the test command line subcommand
<pre>
##########
File path: airflow/models/taskinstance.py
##########
@@ -1495,8 +1495,7 @@ def handle_failure(
except Exception:
self.log.exception('Failed to send email to: %s', task.email)
- if not test_mode:
- session.merge(self)
+ session.merge(self)
Review comment:
@uranusjr Find the one. Looks like it's related to the airflow test
command. In the lasted UT, UT will raise `IndexError: list index out of range`
with the code block `assert tis[0].hostname == "test_hostname"` if remove this
change.
I wonder whether it is reasonable to mix UT and test commands together here
by using a test_mode variable because the test command doesn't want to save the
state into DB/session but UT should save the state into DB/session. Do you have
any idea about it?
<pre>
commit aa01fab4906df3175e5e6589ec0095a5586279db
Author: Maxime Beauchemin <[email protected]>
Date: Mon Jan 12 21:54:40 2015 +0000
Improving the test command line subcommand
https://github.com/apache/airflow/commit/aa01fab4906df3175e5e6589ec0095a5586279db
<pre>
##########
File path: airflow/models/taskinstance.py
##########
@@ -1495,8 +1495,7 @@ def handle_failure(
except Exception:
self.log.exception('Failed to send email to: %s', task.email)
- if not test_mode:
- session.merge(self)
+ session.merge(self)
Review comment:
I add a config `dag_file_processor.UNIT_TEST_MODE = False` in UT as a
workaround. It works well but I wonder whether it is normative.
##########
File path: airflow/models/taskinstance.py
##########
@@ -1495,8 +1495,7 @@ def handle_failure(
except Exception:
self.log.exception('Failed to send email to: %s', task.email)
- if not test_mode:
- session.merge(self)
+ session.merge(self)
Review comment:
@uranusjr Find the one. Looks like it's related to the airflow test
command. In the lasted UT, UT will raise `IndexError: list index out of range`
with the code block `assert tis[0].hostname == "test_hostname"` if remove this
change.
I wonder whether it is reasonable to mix UT and test commands together here
by using a test_mode variable because the test command doesn't want to save the
state into DB/session but UT should save the state into DB/session. Do you have
any idea about it?
<pre>
commit aa01fab4906df3175e5e6589ec0095a5586279db
Author: Maxime Beauchemin <[email protected]>
Date: Mon Jan 12 21:54:40 2015 +0000
Improving the test command line subcommand
https://github.com/apache/airflow/commit/aa01fab4906df3175e5e6589ec0095a5586279db
</pre>
##########
File path: airflow/models/taskinstance.py
##########
@@ -1495,8 +1495,7 @@ def handle_failure(
except Exception:
self.log.exception('Failed to send email to: %s', task.email)
- if not test_mode:
- session.merge(self)
+ session.merge(self)
Review comment:
@uranusjr Find the one. Looks like it's related to the airflow test
command. In the latest UT, UT will raise `IndexError: list index out of range`
with the code block `assert tis[0].hostname == "test_hostname"` if remove this
change.
I wonder whether it is reasonable to mix UT and test commands together here
by using a test_mode variable because the test command doesn't want to save the
state into DB/session but UT should save the state into DB/session. Do you have
any idea about it?
<pre>
commit aa01fab4906df3175e5e6589ec0095a5586279db
Author: Maxime Beauchemin <[email protected]>
Date: Mon Jan 12 21:54:40 2015 +0000
Improving the test command line subcommand
https://github.com/apache/airflow/commit/aa01fab4906df3175e5e6589ec0095a5586279db
</pre>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]