potiuk commented on PR #39770: URL: https://github.com/apache/airflow/pull/39770#issuecomment-2136202667
> > I think better approach is to extract internal method and use `@retry_db_transaction` decorator. > > Good call -- Each of the DB calls in this method already use this decorator. I took a closer look at the traceback, and the exception is actually raised within the `heartbeat_callback` [here](https://github.com/apache/airflow/blob/main/airflow/jobs/job.py#L229), which eventually calls [TaskInstance.get_task_instance](https://github.com/apache/airflow/blob/main/airflow/models/taskinstance.py#L842), which [appears to retry for `ConnectionError` and `NewConnectionError`, but not `OperationalError`](https://github.com/apache/airflow/blob/main/airflow/api_internal/internal_api_call.py#L88). Do you think it makes sense for me to add `OperationalError` as a retryable exception? Not - that's not it. Internal_api_call is for AIP-44 RPC not for DB operations. I thought about extracting/refactoring a pure-DB method for those lines: <img width="679" alt="Screenshot 2024-05-29 at 00 24 21" src="https://github.com/apache/airflow/assets/595491/c6af5b76-831c-49d7-878e-0676bf343cb2"> and wrap them in the decorator. -- 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]
