kyungjunleeme commented on code in PR #53958:
URL: https://github.com/apache/airflow/pull/53958#discussion_r2250635060
##########
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:
> Or another option, is to add a note to it
https://peps.python.org/pep-0678/ -- this works on Python 3.11+, which is now
most of the versions. I think I prefer this (and on 3.10 the behaviour is just
nothing else)
I test on python 3.10.12. I got an Attribute Error
<img width="1004" height="256" alt="image"
src="https://github.com/user-attachments/assets/cfc47586-e5aa-4f5f-a924-d77fed71ac79"
/>
I'll refere to this code. Thanks
```python
if hasattr(BaseException, "add_note"):
# Py 3.11+
raise_on_4xx_5xx = raise_on_4xx_5xx_with_note
```
--
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]