potiuk commented on code in PR #36374:
URL: https://github.com/apache/airflow/pull/36374#discussion_r1436430707


##########
airflow/models/taskinstance.py:
##########
@@ -2361,6 +2361,8 @@ def _run_raw_task(
                     self.log.info(e)
                 if not test_mode:
                     self.refresh_from_db(lock_for_update=True, session=session)
+                
_run_finished_callback(callbacks=self.task.on_skipped_callback, context=context)
+                session.commit()

Review Comment:
   Hmm. In other exception handling code we already commit even if test_mode. I 
wonder if it is a bug (and which)?
   
   ```
               except 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
               except (Exception, KeyboardInterrupt) as e:
                   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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to