From d6254b8db0c4ab9d6588ec84e6abdc3119e3f2bb Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 28 Sep 2026 01:26:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(quality):=20classification=5Fstatus=20?= =?UTF-8?q?=E8=B5=8B=E6=9E=9A=E4=B8=BE=E5=80=BC=E8=80=8C=E9=9D=9E=E8=A3=B8?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=EF=BC=8C=E8=A1=A5=20FAILED=20?= =?UTF-8?q?=E5=88=86=E6=94=AF=20(#2079)=20-=20=E4=BF=AE=E5=A4=8D=20calcula?= =?UTF-8?q?te=5Fasset=5Fquality=20task:99=20=E5=A4=84=20asset.classificati?= =?UTF-8?q?on=5Fstatus=3D"completed"=20=E5=AF=BC=E8=87=B4=20repo.update()?= =?UTF-8?q?=20=E5=9C=A8=20.value=20=E5=A4=84=E6=8A=9B=20'str'=20object=20h?= =?UTF-8?q?as=20no=20attribute=20'value';=20=E5=AF=BC=E5=85=A5=20Classific?= =?UTF-8?q?ationStatus=20=E5=B9=B6=E7=94=A8=20COMPLETED/FAILED=20=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE;=20=E5=88=86=E7=B1=BB=E5=BC=82=E5=B8=B8=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E5=BC=8F=E6=A0=87=E8=AE=B0=20FAILED=20=E9=81=BF?= =?UTF-8?q?=E5=85=8D=20PENDING=20=E6=AD=BB=E5=BE=AA=E7=8E=AF=E9=87=8D?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/worker/worker_app/tasks/asset_quality_scoring_task.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/worker/worker_app/tasks/asset_quality_scoring_task.py b/apps/worker/worker_app/tasks/asset_quality_scoring_task.py index 083b58c49..83a265acd 100644 --- a/apps/worker/worker_app/tasks/asset_quality_scoring_task.py +++ b/apps/worker/worker_app/tasks/asset_quality_scoring_task.py @@ -18,6 +18,7 @@ from worker_app.celery_app import celery_app from worker_app.db import SessionLocal from packages.adapters.sqlalchemy_impl.asset_repository import SQLAlchemyAssetRepository +from packages.domain.classification import ClassificationStatus from packages.shared.storage import get_shared_storage_service logger = get_task_logger(__name__) @@ -96,7 +97,7 @@ def calculate_asset_quality_task(self, asset_id: str) -> dict: confidence = 1.0 existing_meta["classification"] = classification existing_meta["classification_confidence"] = confidence - asset.classification_status = "completed" + asset.classification_status = ClassificationStatus.COMPLETED asset.metadata = existing_meta logger.info( "[quality_score] asset=%s 自动分类完成: category=%s confidence=%.2f", @@ -110,6 +111,8 @@ def calculate_asset_quality_task(self, asset_id: str) -> dict: asset_id, cls_err, ) + # 分类失败显式标记 FAILED,避免停留在 PENDING 被反复重试 + asset.classification_status = ClassificationStatus.FAILED asset_repo.update(asset) db.commit()