jscheffl commented on code in PR #65239:
URL: https://github.com/apache/airflow/pull/65239#discussion_r3210554823
##########
airflow-core/src/airflow/utils/db_cleanup.py:
##########
@@ -612,10 +630,22 @@ def run_cleanup(
session=session,
batch_size=batch_size,
)
- session.commit()
+ if ctx.failed:
+ failed_tables.append(table_name)
else:
logger.warning("Table %s not found. Skipping.", table_name)
+ if failed_tables:
+ if error_on_cleanup_failure:
+ raise RuntimeError(
+ f"airflow db clean encountered errors on the following tables
and did not clean them: "
+ f"{failed_tables}. Check the logs above for details."
+ )
+ logger.warning(
+ "The following tables were not cleaned due to errors: %s. Check
the logs above for details.",
+ failed_tables,
Review Comment:
I think it is okay and clear, raising the exception generates sufficient
logs. The exception traces can be deemed as warning so I think it is a nitpick
and is OK.
--
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]