From 31d2bdd3bb5afd6e9bf33131373d5e657eac4138 Mon Sep 17 00:00:00 2001 From: Bai Date: Wed, 9 Aug 2023 19:30:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87=20celery?= =?UTF-8?q?=5Ftask=5Fid=20=E6=9F=A5=E8=AF=A2=E6=89=A7=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/api/adhoc.py | 3 ++- apps/ops/serializers/adhoc.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ops/api/adhoc.py b/apps/ops/api/adhoc.py index 0cc7b6d55..ac6983669 100644 --- a/apps/ops/api/adhoc.py +++ b/apps/ops/api/adhoc.py @@ -24,7 +24,7 @@ __all__ = [ class TaskViewSet(OrgBulkModelViewSet): model = Task - filterset_fields = ("name",) + filterset_fields = ("name", "adhoc__execution__celery_task_id") search_fields = filterset_fields serializer_class = TaskSerializer @@ -54,6 +54,7 @@ class TaskRun(generics.RetrieveAPIView): class AdHocViewSet(viewsets.ModelViewSet): queryset = AdHoc.objects.all() + filterset_fields = ('execution__celery_task_id', ) serializer_class = AdHocSerializer def get_serializer_class(self): diff --git a/apps/ops/serializers/adhoc.py b/apps/ops/serializers/adhoc.py index 094abf958..eefc185c6 100644 --- a/apps/ops/serializers/adhoc.py +++ b/apps/ops/serializers/adhoc.py @@ -17,7 +17,7 @@ class AdHocExecutionSerializer(serializers.ModelSerializer): fields_mini = ['id'] fields_small = fields_mini + [ 'hosts_amount', 'timedelta', 'result', 'summary', 'short_id', - 'is_finished', 'is_success', + 'is_finished', 'is_success', 'celery_task_id', 'date_start', 'date_finished', ] fields_fk = ['task', 'task_display', 'adhoc', 'adhoc_short_id',]