Copilot commented on code in PR #65239:
URL: https://github.com/apache/airflow/pull/65239#discussion_r3207078065
##########
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:
PR description says the failure-summary WARNING is "always" emitted when
per-table cleanup errors occur, but the current implementation raises
`RuntimeError` when `error_on_cleanup_failure=True` without logging the summary
WARNING (it only appears in the exception message). Please update the PR
description to match the implemented behavior (or adjust implementation if you
still want a WARNING summary in the error-on-failure case).
--
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]