From 1bb960666a03d135efff024f1520dda8293ac3d9 Mon Sep 17 00:00:00 2001 From: yanta Date: Thu, 19 Sep 2024 10:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E5=BD=92=E6=A1=A3=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=A0=E5=8F=82=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/archiver.py | 2 +- sql/utils/tasks.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/archiver.py b/sql/archiver.py index 9bc5cf11cd..d04ea7f5bf 100644 --- a/sql/archiver.py +++ b/sql/archiver.py @@ -535,5 +535,5 @@ def archive_switch(request): def archive_once(request): """单次立即调用归档任务""" archive_id = request.GET.get("archive_id") - archive.apply_async(archive_id) # 使用 Celery 的apply_async方法调度任务 + archive.apply_async(args=[archive_id]) # 使用 Celery 的apply_async方法调度任务 return JsonResponse({"status": 0, "msg": "ok", "data": {}}) diff --git a/sql/utils/tasks.py b/sql/utils/tasks.py index 15de20f7fb..5b271994f2 100644 --- a/sql/utils/tasks.py +++ b/sql/utils/tasks.py @@ -58,7 +58,10 @@ def del_schedule(name): def task_info(name): - """获取定时任务详情""" + """ + 获取定时任务详情 + 如果未使用celery beat实现的定时任务,这里无法获取到对应的结果,只会返回一个None + """ try: periodic_task = PeriodicTask.objects.get(name=name) return periodic_task