potiuk commented on code in PR #66450:
URL: https://github.com/apache/airflow/pull/66450#discussion_r3215591256
##########
airflow-core/src/airflow/utils/log/log_stream_accumulator.py:
##########
@@ -31,6 +33,24 @@
StructuredLogStream,
)
+logger = logging.getLogger(__name__)
+
+
+def _safe_remove(path: str) -> None:
+ """
+ Remove path, swallowing missing-file errors and logging others.
+
+ Module-level rather than a method so weakref.finalize can hold it
+ without retaining a strong reference to the owning accumulator (which
+ would defeat the backstop).
+ """
+ try:
+ os.remove(path)
+ except FileNotFoundError:
+ pass
+ except OSError as exc:
+ logger.debug("LogStreamAccumulator: could not remove temp file %s:
%s", path, exc)
Review Comment:
Consider bumping non-`FileNotFoundError` `OSError`s to `warning`. Right now
`EACCES` (perm denied) or `ENOSPC` (out of space) — exactly the kinds of
failures that could produce a future orphan pile — would disappear silently
into debug logs. `warning` is loud enough to surface in centralised logging
without being spammy, since this branch only fires when `os.remove` actually
fails for a non-missing reason.
--
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]