kyungjunleeme commented on code in PR #53958:
URL: https://github.com/apache/airflow/pull/53958#discussion_r2245063973


##########
airflow-core/src/airflow/dag_processing/bundles/base.py:
##########
@@ -428,12 +429,23 @@ def acquire(self):
         self._update_version_file()
         if TYPE_CHECKING:
             assert self.lock_file_path
+        # Raises FileNotFoundError if the path doesn't exist,
+        # or PermissionError if access is denied
         self.lock_file = open(self.lock_file_path)
-        flock(self.lock_file, LOCK_SH)
+        # https://docs.python.org/3/library/fcntl.html#fcntl.flock
+        try:
+            flock(self.lock_file, LOCK_SH)
+        except (BlockingIOError, OSError) as e:
+            self._log_exc("Error acquiring lock")
+            raise AirflowFileLockAcquireException(self.lock_file_path, e) from 
e

Review Comment:
   While I initially added them to distinguish file lock-related errors more 
clearly, I’m happy to simplify the code by removing the custom exceptions and 
using AirflowException instead.



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