uranusjr commented on code in PR #60164:
URL: https://github.com/apache/airflow/pull/60164#discussion_r2674404225
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py:
##########
@@ -1741,6 +1742,17 @@ def _sync_to_local_dir_delete_stale_local_files(self,
current_s3_objects: list[P
self.log.error("Error deleting stale item %s: %s", item, e)
raise e
+ def _compute_local_file_md5(self, file_path: Path) -> str:
+ hash_md5 = hashlib.md5(usedforsecurity=False)
+ try:
+ with open(file_path, "rb") as f:
+ for chunk in iter(lambda: f.read(8192), b""):
+ hash_md5.update(chunk)
+ except (FileNotFoundError, PermissionError, OSError) as e:
+ self.log.error("Failed to compute MD5 for local file %s: %s",
file_path, e)
+ raise AirflowException(f"Failed to compute MD5 for local file
{file_path}: {e}") from e
Review Comment:
```suggestion
except (FileNotFoundError, PermissionError, OSError) as e:
self.log.exception("Failed to compute MD5 for local file %s",
file_path)
raise
```
--
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]