kyungjunleeme commented on code in PR #53958:
URL: https://github.com/apache/airflow/pull/53958#discussion_r2245172975
##########
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:
Thank you so much! Based on your feedback, I’ll take some time to think
through how to make the code cleaner and more maintainable. Once it’s ready,
I’ll submit it for another review.
--
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]