From 8ffe2542aee7c9a322d8c85147a98aaa2a1f6ed1 Mon Sep 17 00:00:00 2001 From: Georgiana Dolocan Date: Tue, 29 Oct 2024 18:17:45 +0200 Subject: [PATCH 1/2] Address feedback --- frx_challenges/web/management/commands/evaluator.py | 3 +-- helm-chart/templates/deployment.yaml | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/frx_challenges/web/management/commands/evaluator.py b/frx_challenges/web/management/commands/evaluator.py index d378e93..79fb9a4 100644 --- a/frx_challenges/web/management/commands/evaluator.py +++ b/frx_challenges/web/management/commands/evaluator.py @@ -8,7 +8,6 @@ import aiodocker import aiodocker.containers import fsspec -from asgiref.sync import sync_to_async from django.conf import settings from django.core.management.base import BaseCommand from django.db.models import Exists, OuterRef, Q @@ -189,7 +188,7 @@ async def ahandle(self): # Get the number of running evaluations # This is a synchronous operation so it's wrapped in sync_to_async - num = await sync_to_async(running_evaluations.count)() + num = await running_evaluations.acount() async for e in unstarted_evaluations: # Only start a new evaluation if the number of running evaluations is less than the maximum if num < settings.MAX_RUNNING_EVALUATIONS: diff --git a/helm-chart/templates/deployment.yaml b/helm-chart/templates/deployment.yaml index 081f93b..357680d 100644 --- a/helm-chart/templates/deployment.yaml +++ b/helm-chart/templates/deployment.yaml @@ -56,21 +56,18 @@ spec: subPath: frx_challenges.yaml - name: staticfiles mountPath: /opt/staticfiles + {{- if .Values.adminUsers }} - name: admin-add image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: - {{- if .Values.adminUsers }} - python - manage.py - promote {{- range .Values.adminUsers }} - {{ . }} {{- end }} - {{- else }} - - echo - - "No admin users to add" - {{- end }} + {{- end }} securityContext: runAsUser: 0 volumeMounts: From 410b7a3744829ab05149b6b2aa567bf2e58b1278 Mon Sep 17 00:00:00 2001 From: Georgiana Dolocan Date: Wed, 30 Oct 2024 11:38:43 +0200 Subject: [PATCH 2/2] Correctly close the if statement --- helm-chart/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/templates/deployment.yaml b/helm-chart/templates/deployment.yaml index 357680d..3fd93e4 100644 --- a/helm-chart/templates/deployment.yaml +++ b/helm-chart/templates/deployment.yaml @@ -67,7 +67,6 @@ spec: {{- range .Values.adminUsers }} - {{ . }} {{- end }} - {{- end }} securityContext: runAsUser: 0 volumeMounts: @@ -76,6 +75,7 @@ spec: - name: django-yamlconf mountPath: /opt/frx-challenges/frx_challenges/frx_challenges.yaml subPath: frx_challenges.yaml + {{- end }} {{ with .Values.extraInitContainers }} {{ $extraInitContainers := . }} {{ $sortedKeys := keys $extraInitContainers | sortAlpha }}