From 82535be86b5b8fd1105f0d238b2ab5e4f5fcae32 Mon Sep 17 00:00:00 2001 From: ITQ Date: Sun, 2 Mar 2025 02:58:37 +0300 Subject: [PATCH 1/4] (scope): [body] [footer(s)] --- services/backend/apps/competition/models.py | 1 + services/backend/checker_requirements.txt | 7 +++++++ services/backend/pyproject.toml | 10 +++++----- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 services/backend/checker_requirements.txt diff --git a/services/backend/apps/competition/models.py b/services/backend/apps/competition/models.py index 9c0c0fc..4658048 100644 --- a/services/backend/apps/competition/models.py +++ b/services/backend/apps/competition/models.py @@ -10,6 +10,7 @@ class Competition(BaseModel): class CompetitionType(models.TextChoices): EDU = "edu", "Образовательный" COMPETITIVE = "competitive", "Соревновательный" + class CompetitionParticipationType(models.TextChoices): SOLO = "solo", "Индивидуальный" diff --git a/services/backend/checker_requirements.txt b/services/backend/checker_requirements.txt new file mode 100644 index 0000000..7cc32d3 --- /dev/null +++ b/services/backend/checker_requirements.txt @@ -0,0 +1,7 @@ +pandas==2.2.3 +numpy==2.2.3 +matplotlib==3.10.1 +scipy==1.15.2 +scikit-learn==1.6.1 +seaborn==0.13.2 +statsmodels==0.14.4 diff --git a/services/backend/pyproject.toml b/services/backend/pyproject.toml index 056017b..20b218e 100644 --- a/services/backend/pyproject.toml +++ b/services/backend/pyproject.toml @@ -32,11 +32,11 @@ dependencies = [ [dependency-groups] dev = [ - "coverage>=7.6.12", - "django-debug-toolbar>=4.4.6", - "django-stubs[compatible-mypy]>=5.1.3", - "mypy>=1.15.0", - "ruff>=0.9.3", + "coverage>=7.6.12", + "django-debug-toolbar>=4.4.6", + "django-stubs[compatible-mypy]>=5.1.3", + "mypy>=1.15.0", + "ruff>=0.9.3", ] [tool.ruff] From 2af150493b0a8a2eb866108a8cb6ed819fbef259 Mon Sep 17 00:00:00 2001 From: ITQ Date: Sun, 2 Mar 2025 03:00:43 +0300 Subject: [PATCH 2/4] (scope): [body] [footer(s)] --- compose.yaml | 6 +++++- .../backend/scripts/celery-worker-entrypoint.sh | 9 +++++++++ services/backend/Dockerfile.staticfiles | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 infrastructure/backend/scripts/celery-worker-entrypoint.sh diff --git a/compose.yaml b/compose.yaml index 9aac6d8..4850fb3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -88,7 +88,7 @@ services: image: gitlab.prodcontest.ru:5050/team-15/project/backend:latest build: context: ./services/backend - command: celery -A config worker -l INFO + entrypoint: ["/scripts/celery-worker-entrypoint.sh"] depends_on: redis: restart: false @@ -106,6 +106,10 @@ services: retries: 3 start_period: 10s start_interval: 2s + volumes: + - type: bind + source: ./infrastructure/backend/scripts + target: /scripts restart: unless-stopped celery-exporter: diff --git a/infrastructure/backend/scripts/celery-worker-entrypoint.sh b/infrastructure/backend/scripts/celery-worker-entrypoint.sh new file mode 100644 index 0000000..3afd460 --- /dev/null +++ b/infrastructure/backend/scripts/celery-worker-entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +echo "Installing required libs..." +pip install -r checker_requirements.txt + +echo "Starting Celery worker..." +celery -A config worker -l INFO diff --git a/services/backend/Dockerfile.staticfiles b/services/backend/Dockerfile.staticfiles index 5150bf5..d5199e1 100644 --- a/services/backend/Dockerfile.staticfiles +++ b/services/backend/Dockerfile.staticfiles @@ -24,4 +24,6 @@ FROM docker.io/nginx:latest COPY --from=builder /app/static /usr/share/nginx/html +COPY checker_requirements.txt /usr/share/nginx/html + CMD ["nginx", "-g", "daemon off;"] From 3ef952c1145b65fbd1ebd2b2f34719b5edf6c6f4 Mon Sep 17 00:00:00 2001 From: ITQ Date: Sun, 2 Mar 2025 03:10:22 +0300 Subject: [PATCH 3/4] (scope): [body] [footer(s)] --- .../migrations/0002_alter_state_state.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 services/backend/apps/competition/migrations/0002_alter_state_state.py diff --git a/services/backend/apps/competition/migrations/0002_alter_state_state.py b/services/backend/apps/competition/migrations/0002_alter_state_state.py new file mode 100644 index 0000000..9814e70 --- /dev/null +++ b/services/backend/apps/competition/migrations/0002_alter_state_state.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.6 on 2025-03-02 00:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('competition', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='state', + name='state', + field=models.CharField(choices=[('not_started', 'Not Started'), ('started', 'Started'), ('finished', 'Finished')], default='not_started', max_length=11), + ), + ] From 5c2f44115333977326bd96c4d7887aae873c8979 Mon Sep 17 00:00:00 2001 From: ITQ Date: Sun, 2 Mar 2025 03:12:52 +0300 Subject: [PATCH 4/4] (scope): [body] [footer(s)] --- compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yaml b/compose.yaml index 4850fb3..5cfe9ac 100644 --- a/compose.yaml +++ b/compose.yaml @@ -88,7 +88,7 @@ services: image: gitlab.prodcontest.ru:5050/team-15/project/backend:latest build: context: ./services/backend - entrypoint: ["/scripts/celery-worker-entrypoint.sh"] + entrypoint: ["/app/scripts/celery-worker-entrypoint.sh"] depends_on: redis: restart: false @@ -109,7 +109,7 @@ services: volumes: - type: bind source: ./infrastructure/backend/scripts - target: /scripts + target: /app/scripts restart: unless-stopped celery-exporter: