Skip to content

Commit 459da04

Browse files
committed
Align the artifact sweep with the other cleanup checks
The sweep's interval check now reads like the bundle-version cleanup next to it, and its deleted-row count no longer hides a missing rowcount behind a default that can never apply. The parsing_cleanup_interval description said the artifact deletion in a clause that did not parse cleanly.
1 parent 3cccb23 commit 459da04

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎airflow-core/src/airflow/config_templates/config.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,8 +2727,8 @@ scheduler:
27272727
description: |
27282728
How often (in seconds) to check for stale DAGs (DAGs which are no longer present in
27292729
the expected files) which should be deactivated, as well as assets that are no longer
2730-
referenced and should be marked as orphaned, and Lang-SDK task handler artifacts that no
2731-
stub task uses any more, which are deleted.
2730+
referenced and should be marked as orphaned. The same check deletes the Lang-SDK task
2731+
handler artifacts that no stub task uses any more.
27322732
version_added: 2.5.0
27332733
type: integer
27342734
example: ~

‎airflow-core/src/airflow/dag_processing/manager.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
from collections.abc import Callable, Collection, Iterable, Iterator, Sequence
9898
from socket import socket
9999

100+
from sqlalchemy.engine import CursorResult
100101
from sqlalchemy.orm import Session
101102
from sqlalchemy.sql import Select
102103

@@ -462,7 +463,7 @@ def _scan_stale_dags(self):
462463

463464
def _sweep_task_handler_artifacts(self) -> None:
464465
now = time.monotonic()
465-
if now - self._last_task_handler_artifact_sweep_time <= self.parsing_cleanup_interval:
466+
if now - self._last_task_handler_artifact_sweep_time < self.parsing_cleanup_interval:
466467
return
467468
try:
468469
self.delete_unreferenced_task_handler_artifacts()
@@ -508,7 +509,7 @@ def delete_unreferenced_task_handler_artifacts(self) -> int:
508509
.where(LangSDKTaskHandlerArtifact.id.in_(ids), *sweepable)
509510
.execution_options(synchronize_session=False)
510511
)
511-
deleted += getattr(result, "rowcount", 0)
512+
deleted += cast("CursorResult", result).rowcount
512513
if len(ids) < _TASK_HANDLER_ARTIFACT_SWEEP_BATCH_SIZE:
513514
break
514515
if deleted:

0 commit comments

Comments
 (0)