Taragolis commented on issue #39680:
URL: https://github.com/apache/airflow/issues/39680#issuecomment-2117588770

   > yeah, would be great to avoid DB internal error
   
   Feel free to fix it. Apache Airflow it is open source project, and every one 
could contribute changes (fixes/features) back, especially if they know what 
then outcome achievement/benefits of the changes.
   
   So I would recommend try to patch this part into your side and check is it 
still work as expected, and without additional error logs in DB backend and 
without side effects.
   
   ```diff
   diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py
   index f154461a77..a08b9cd94a 100644
   --- a/airflow/models/taskinstance.py
   +++ b/airflow/models/taskinstance.py
   @@ -3454,8 +3454,12 @@ class TaskInstance(Base, LoggingMixin):
                        run_id=ti.run_id,
                    ),
                    session=session,
   -                nowait=True,
   -            ).one()
   +                skip_locked=True,
   +            ).one_or_none()
   +            if not dag_run:
   +                # Need to log something?
   +                session.rollback()
   +                return
    
                task = ti.task
                if TYPE_CHECKING:
   ```


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