Fix: always update classifier task result (#9817)

This commit is contained in:
shamoon 2025-04-29 11:46:18 -07:00 committed by GitHub
parent 7236b8b682
commit 924a13f724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -123,14 +123,15 @@ def train_classifier(*, scheduled=True):
task.result = "Training data unchanged" task.result = "Training data unchanged"
task.status = states.SUCCESS task.status = states.SUCCESS
task.date_done = timezone.now()
task.save(update_fields=["status", "result", "date_done"])
except Exception as e: except Exception as e:
logger.warning("Classifier error: " + str(e)) logger.warning("Classifier error: " + str(e))
task.status = states.FAILURE task.status = states.FAILURE
task.result = str(e) task.result = str(e)
task.date_done = timezone.now()
task.save(update_fields=["status", "result", "date_done"])
@shared_task(bind=True) @shared_task(bind=True)
def consume_file( def consume_file(