ephraimbuddy commented on a change in pull request #17819:
URL: https://github.com/apache/airflow/pull/17819#discussion_r710177997
##########
File path: tests/models/test_taskinstance.py
##########
@@ -1683,6 +1683,21 @@ def test_handle_failure(self, create_dummy_dag,
session=None):
assert context_arg_3 and "task_instance" in context_arg_3
mock_on_retry_3.assert_not_called()
+ def test_handle_failure_updates_queued_task_try_number(self, dag_maker):
+ session = settings.Session()
+ with dag_maker():
+ task = DummyOperator(task_id="mytask", retries=1)
+ dr = dag_maker.create_dagrun()
+ ti = TI(task=task, run_id=dr.run_id)
+ ti.state = State.QUEUED
+ session.merge(ti)
+ session.commit()
+ assert ti.state == State.QUEUED
+ assert ti.try_number == 1
+ ti.handle_failure("test queued ti", test_mode=True)
+ assert ti.state == State.UP_FOR_RETRY
+ assert ti.try_number == 3
Review comment:
Quiet confusing. I have put breakpoints to see how it's happening but no
result. If I remove the increment of the try_numer, the try_number remains 1
after running the handle_failure
--
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]