ephraimbuddy commented on issue #30146:
URL: https://github.com/apache/airflow/issues/30146#issuecomment-1472299515

   @eejbyfeldt , I will like you to test this:
   
   ```diff
   
   diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py
   index ffcdfb5651..180e009de5 100644
   --- a/airflow/models/taskinstance.py
   +++ b/airflow/models/taskinstance.py
   @@ -1580,9 +1580,12 @@ class TaskInstance(Base, LoggingMixin):
                        self.task.post_execute(context=context, result=result)
                    except AirflowTermSignal:
                        self.task.on_kill()
   +                    if self.task.retries:
   +                        raise AirflowException("Task received SIGTERM 
signal")
                        if self.task.on_failure_callback:
                            
self._run_finished_callback(self.task.on_failure_callback, context, 
"on_failure")
   -                    raise AirflowException("Task received SIGTERM signal")
   +
   +
    
            Stats.incr(f"operator_successes_{self.task.task_type}", 1, 1)
            Stats.incr(
   diff --git a/tests/models/test_taskinstance.py 
b/tests/models/test_taskinstance.py
   index 50cac05296..d420ab694a 100644
   --- a/tests/models/test_taskinstance.py
   +++ b/tests/models/test_taskinstance.py
   @@ -490,8 +490,7 @@ class TestTaskInstance:
            dr = dag_maker.create_dagrun()
            ti = dr.task_instances[0]
            ti.task = task_
   -        with pytest.raises(AirflowException):
   -            ti.run()
   +        ti.run()
            assert "on_failure_callback called" in caplog.text
    
        @pytest.mark.parametrize("state", [State.SUCCESS, State.FAILED, 
State.SKIPPED])
   ```
   


-- 
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]

Reply via email to