nailo2c commented on code in PR #60734:
URL: https://github.com/apache/airflow/pull/60734#discussion_r2742803405


##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -299,6 +304,20 @@ def _scan_stale_dags(self):
             self.deactivate_stale_dags(last_parsed=last_parsed)
             self._last_deactivate_stale_dags_time = time.monotonic()
 
+    def _cleanup_stale_bundle_versions(self):
+        if self.stale_bundle_cleanup_interval <= 0:
+            return
+        now = time.monotonic()
+        elapsed_time_since_cleanup = now - self._last_stale_bundle_cleanup_time
+        if elapsed_time_since_cleanup < self.stale_bundle_cleanup_interval:
+            return
+        try:
+            BundleUsageTrackingManager().remove_stale_bundle_versions()
+        except Exception:
+            self.log.exception("Error removing stale bundle versions")

Review Comment:
   No worries, logging exception will also print out the exception message too 
:)
   
   ```console
   >>> import logging
   >>> logger = logging.getLogger("demo")
   >>> 
   >>> try:
   ...     1 / 0
   ... except Exception:
   ...     logger.exception("A) logger.exception(...) output")
   ... 
   A) logger.exception(...) output
   Traceback (most recent call last):
     File "<stdin>", line 2, in <module>
   ZeroDivisionError: division by zero
   >>> 
   >>> 
   >>> try:
   ...     1 / 0
   ... except Exception:
   ...     logger.error("B) logger.error(...) output")
   ... 
   B) logger.error(...) output
   >>>
   ```



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