FFCMSouza commented on issue #38935:
URL: https://github.com/apache/airflow/issues/38935#issuecomment-2050273127

   I saw that on version 1.9.0, thats already a different type of exception for 
this cases.
   I believe that the following change could be made to fix that behavior:
   `            except (AirflowFailException, AirflowSensorTimeout, 
AirflowTaskTerminated) as e:
                   # If AirflowFailException is raised, task should not retry.
                   # If a sensor in reschedule mode reaches timeout, task 
should not retry.
                   self.handle_failure(e, test_mode, context, force_fail=True, 
session=session)
                   session.commit()
                   raise
               except (AirflowTaskTimeout, AirflowException) as e:
                   if not test_mode:
                       self.refresh_from_db(lock_for_update=True, 
session=session)
                   # for case when task is marked as success/failed externally
                   # or dagrun timed out and task is marked as skipped
                   # current behavior doesn't hit the callbacks
                   if self.state in State.finished:
                       self.clear_next_method_args()
                       session.merge(self)
                       session.commit()
                       return None
                   else:
                       self.handle_failure(e, test_mode, context, 
session=session)
                       session.commit()
                       raise`


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