alexandrusoare commented on code in PR #44892:
URL: https://github.com/apache/superset/pull/44892#discussion_r4183597338
##########
superset/tasks/deletion_retention.py:
##########
@@ -132,6 +133,54 @@ def _report_model_counts(outcome: str, counts: dict[str,
int]) -> None:
)
+@dataclass
+class _PassTotals:
+ """What one pass over the soft-delete roots produced."""
+
+ purged: dict[str, int] = field(default_factory=dict)
+ would_purge: dict[str, int] = field(default_factory=dict)
+ unsupported: dict[str, int] = field(default_factory=dict)
+ cascade_failures: int = 0
+ blocked: int = 0
+ scan_failures: int = 0
+
+
+def _purge_roots(cutoff: datetime, dry_run: bool) -> _PassTotals:
+ """Process each registered root, isolating one root's failure from the
rest."""
+ totals = _PassTotals()
+ for model in _soft_delete_models():
+ entity_type = _model_table_name(model)
+ try:
+ if model not in purge_policy_registry():
+ totals.unsupported[entity_type] = 1
+ logger.warning(
+ "deletion_retention: skipping %s: no purge policy",
entity_type
+ )
+ stats_logger_manager.instance.incr(
+ f"{_METRIC_PREFIX}.unsupported_models.{entity_type}"
+ )
+ continue
+ purged_n, would_n, failed_n, blocked_n = _purge_model(
+ model, cutoff, dry_run
+ )
+ except Exception: # pylint: disable=broad-except
Review Comment:
Policies are now validated when they're admitted, logged with the reason and
dropped, so their root reports as unsupported and the task never sees one.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]