This is an automated email from the ASF dual-hosted git repository.
ash pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 72679be Simplify "invalid TI state" message (#19029)
72679be is described below
commit 72679bef3abee141dd20f75d6ff977bd3978ecc8
Author: Daniel Standish <[email protected]>
AuthorDate: Thu Nov 4 04:11:23 2021 -0700
Simplify "invalid TI state" message (#19029)
Currently in the web UI on task instance details page, if a task is in the
"up for retry" state
we will see this message:
"Task is in the up_for_retry state which is not a valid state for
execution. The task must be cleared in order to be run."
This might suggest to the user "you need to clear this in order for this
task to run". But this is not true. But it is not simple to make it clearer,
because this function is used for a lot of different scenarios. For example,
checking for "schedulable" tasks, and "queueable" tasks. So not only would we
need to keep track of which states actually require user intervention, but the
desired action (e.g. queue vs schedule vs run).
So I think the best course of action is to simplify this to say only what
is always true, and that is just the state.
---
airflow/ti_deps/deps/valid_state_dep.py | 7 +------
tests/www/views/test_views_tasks.py | 10 ++--------
2 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/airflow/ti_deps/deps/valid_state_dep.py
b/airflow/ti_deps/deps/valid_state_dep.py
index 5ec1402..0e89e68 100644
--- a/airflow/ti_deps/deps/valid_state_dep.py
+++ b/airflow/ti_deps/deps/valid_state_dep.py
@@ -57,9 +57,4 @@ class ValidStateDep(BaseTIDep):
yield self._passing_status(reason=f"Task state {ti.state} was
valid.")
return
- yield self._failing_status(
- reason=(
- f"Task is in the '{ti.state}' state which is not a valid state
for execution. "
- f"The task must be cleared in order to be run."
- )
- )
+ yield self._failing_status(reason=f"Task is in the '{ti.state}'
state.")
diff --git a/tests/www/views/test_views_tasks.py
b/tests/www/views/test_views_tasks.py
index 76a7148..3a4be86 100644
--- a/tests/www/views/test_views_tasks.py
+++ b/tests/www/views/test_views_tasks.py
@@ -477,10 +477,7 @@ def test_run_with_runnable_states(_, admin_client,
session, state):
resp = admin_client.post('run', data=form, follow_redirects=True)
check_content_in_response('', resp)
- msg = (
- f"Task is in the '{state}' state which is not a valid state
for "
- f"execution. The task must be cleared in order to be run"
- )
+ msg = f"Task is in the '{state}' state."
assert not re.search(msg, resp.get_data(as_text=True))
@@ -509,10 +506,7 @@ def test_run_with_not_runnable_states(_, admin_client,
session, state):
resp = admin_client.post('run', data=form, follow_redirects=True)
check_content_in_response('', resp)
- msg = (
- f"Task is in the '{state}' state which is not a valid state
for "
- f"execution. The task must be cleared in order to be run"
- )
+ msg = f"Task is in the '{state}' state."
assert re.search(msg, resp.get_data(as_text=True))