From 2a696ee192df0a9b0459fa88ba0cc3168821e4c9 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Thu, 19 Sep 2024 15:30:59 -0700 Subject: [PATCH 01/17] add more trial logging --- mcserver/admin.py | 2 + .../migrations/0035_auto_20240919_2223.py | 43 +++++++++++++++++++ mcserver/models.py | 5 +++ mcserver/serializers.py | 2 + mcserver/views.py | 13 ++++++ requirements.txt | 10 ++--- 6 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 mcserver/migrations/0035_auto_20240919_2223.py diff --git a/mcserver/admin.py b/mcserver/admin.py index a15e8b4..1b8672b 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -101,6 +101,8 @@ class TrialAdmin(admin.ModelAdmin): 'session', 'status', 'created_at', 'updated_at', + 'server', 'is_docker', 'hostname', + 'processed_duration', 'processed_count', 'trashed', 'trashed_at', ) raw_id_fields = ('session',) diff --git a/mcserver/migrations/0035_auto_20240919_2223.py b/mcserver/migrations/0035_auto_20240919_2223.py new file mode 100644 index 0000000..5bc5f71 --- /dev/null +++ b/mcserver/migrations/0035_auto_20240919_2223.py @@ -0,0 +1,43 @@ +# Generated by Django 3.2 on 2024-09-19 22:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mcserver', '0034_auto_20240409_1133'), + ] + + operations = [ + migrations.AddField( + model_name='trial', + name='hostname', + field=models.CharField(blank=True, max_length=64, null=True), + ), + migrations.AddField( + model_name='trial', + name='is_docker', + field=models.BooleanField(blank=True, null=True), + ), + migrations.AddField( + model_name='trial', + name='processed_count', + field=models.IntegerField(default=0), + ), + migrations.AddField( + model_name='trial', + name='processed_duration', + field=models.DurationField(blank=True, null=True), + ), + migrations.AddField( + model_name='trial', + name='server', + field=models.GenericIPAddressField(blank=True, null=True), + ), + migrations.AlterField( + model_name='analysisresult', + name='status', + field=models.IntegerField(choices=[(100, 'Continue'), (101, 'Switching Protocols'), (102, 'Processing'), (200, 'OK'), (201, 'Created'), (202, 'Accepted'), (203, 'Non-Authoritative Information'), (204, 'No Content'), (205, 'Reset Content'), (206, 'Partial Content'), (207, 'Multi-Status'), (208, 'Already Reported'), (226, 'IM Used'), (300, 'Multiple Choices'), (301, 'Moved Permanently'), (302, 'Found'), (303, 'See Other'), (304, 'Not Modified'), (305, 'Use Proxy'), (307, 'Temporary Redirect'), (308, 'Permanent Redirect'), (400, 'Bad Request'), (401, 'Unauthorized'), (402, 'Payment Required'), (403, 'Forbidden'), (404, 'Not Found'), (405, 'Method Not Allowed'), (406, 'Not Acceptable'), (407, 'Proxy Authentication Required'), (408, 'Request Timeout'), (409, 'Conflict'), (410, 'Gone'), (411, 'Length Required'), (412, 'Precondition Failed'), (413, 'Request Entity Too Large'), (414, 'Request-URI Too Long'), (415, 'Unsupported Media Type'), (416, 'Requested Range Not Satisfiable'), (417, 'Expectation Failed'), (421, 'Misdirected Request'), (422, 'Unprocessable Entity'), (423, 'Locked'), (424, 'Failed Dependency'), (426, 'Upgrade Required'), (428, 'Precondition Required'), (429, 'Too Many Requests'), (431, 'Request Header Fields Too Large'), (451, 'Unavailable For Legal Reasons'), (500, 'Internal Server Error'), (501, 'Not Implemented'), (502, 'Bad Gateway'), (503, 'Service Unavailable'), (504, 'Gateway Timeout'), (505, 'HTTP Version Not Supported'), (506, 'Variant Also Negotiates'), (507, 'Insufficient Storage'), (508, 'Loop Detected'), (510, 'Not Extended'), (511, 'Network Authentication Required')], default=200, help_text='Status code function responsed with.', verbose_name='Status'), + ), + ] diff --git a/mcserver/models.py b/mcserver/models.py index 03db7d3..01a2af7 100644 --- a/mcserver/models.py +++ b/mcserver/models.py @@ -108,6 +108,11 @@ class Trial(models.Model): meta = models.JSONField(blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True, db_index=True) updated_at = models.DateTimeField(auto_now=True) + server = models.GenericIPAddressField(null=True, blank=True) + is_docker = models.BooleanField(null=True, blank=True) + hostname = models.CharField(max_length=64, null=True, blank=True) + processed_duration = models.DurationField(null=True, blank=True) + processed_count = models.IntegerField(default=0) trashed = models.BooleanField(default=False) trashed_at = models.DateTimeField(blank=True, null=True) diff --git a/mcserver/serializers.py b/mcserver/serializers.py index b695a96..a69a818 100644 --- a/mcserver/serializers.py +++ b/mcserver/serializers.py @@ -152,6 +152,8 @@ class Meta: fields = [ 'id', 'session', 'name', 'status', 'videos', 'results', 'meta', 'created_at', 'updated_at', + 'server', 'is_docker', 'hostname', + 'processed_duration', 'processed_count', 'trashed', 'trashed_at', ] diff --git a/mcserver/views.py b/mcserver/views.py index 9bc49e4..702f3bc 100644 --- a/mcserver/views.py +++ b/mcserver/views.py @@ -7,6 +7,7 @@ import time import platform import traceback +import socket from datetime import datetime, timedelta @@ -144,6 +145,14 @@ def get_client_ip(request): ip = request.META.get('REMOTE_ADDR') return ip +def get_client_hostname(request): + ip = get_client_ip(request) + try: + hostname = socket.gethostbyaddr(ip) + return hostname[0] + except socket.herror: + return None + def zipdir(path, ziph): # ziph is zipfile handle for root, dirs, files in os.walk(path): @@ -1445,6 +1454,7 @@ class TrialViewSet(viewsets.ModelViewSet): def dequeue(self, request): try: ip = get_client_ip(request) + hostname = get_client_hostname(request) workerType = self.request.query_params.get('workerType') @@ -1497,6 +1507,9 @@ def dequeue(self, request): trial = trialsPrioritized[0] trial.status = "processing" + trial.server = ip + trial.hostname = hostname + trial.processed_count = F("processed_count") + 1 trial.save() print(ip) diff --git a/requirements.txt b/requirements.txt index aad3497..4800b9b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,27 +26,27 @@ importlib-metadata==4.13.0 jmespath==0.10.0 kiwisolver==1.4.4 kombu==5.2.4 -matplotlib==3.3.4 +matplotlib==3.5.3 numpy==1.21.6 packaging==23.0 -pandas==1.1.5 +pandas==1.5.3 Pillow==9.3.0 pip-tools==6.12.2 prompt-toolkit==3.0.36 -psycopg2==2.9.3 +psycopg2-binary==2.9.3 pyparsing==3.0.9 pypng==0.20220715.0 pyproject_hooks==1.0.0 python-dateutil==2.8.2 python-decouple==3.7 pytz==2022.7.1 -PyYAML==5.4.1 +PyYAML==6.0.1 qrcode==7.4 redis==4.4.2 regex==2022.10.31 requests==2.28.2 s3transfer==0.3.7 -scipy==1.7.2 +scipy==1.7.3 sentry-sdk==1.14.0 six==1.16.0 sniffio==1.3.0 From 3d1dd41e5c639c9c7f1fdc6685d77e390d7c1931 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Thu, 19 Sep 2024 15:45:43 -0700 Subject: [PATCH 02/17] revert requirements file --- requirements.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4800b9b..aad3497 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,27 +26,27 @@ importlib-metadata==4.13.0 jmespath==0.10.0 kiwisolver==1.4.4 kombu==5.2.4 -matplotlib==3.5.3 +matplotlib==3.3.4 numpy==1.21.6 packaging==23.0 -pandas==1.5.3 +pandas==1.1.5 Pillow==9.3.0 pip-tools==6.12.2 prompt-toolkit==3.0.36 -psycopg2-binary==2.9.3 +psycopg2==2.9.3 pyparsing==3.0.9 pypng==0.20220715.0 pyproject_hooks==1.0.0 python-dateutil==2.8.2 python-decouple==3.7 pytz==2022.7.1 -PyYAML==6.0.1 +PyYAML==5.4.1 qrcode==7.4 redis==4.4.2 regex==2022.10.31 requests==2.28.2 s3transfer==0.3.7 -scipy==1.7.3 +scipy==1.7.2 sentry-sdk==1.14.0 six==1.16.0 sniffio==1.3.0 From 686ce392aab929ad7fe93d408b0639bee3d7b9b8 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Thu, 19 Sep 2024 18:24:29 -0700 Subject: [PATCH 03/17] sync migrations --- ...919_2223.py => 0035_auto_20240918_2354.py} | 9 ++----- .../migrations/0036_auto_20240919_2329.py | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) rename mcserver/migrations/{0035_auto_20240919_2223.py => 0035_auto_20240918_2354.py} (91%) create mode 100644 mcserver/migrations/0036_auto_20240919_2329.py diff --git a/mcserver/migrations/0035_auto_20240919_2223.py b/mcserver/migrations/0035_auto_20240918_2354.py similarity index 91% rename from mcserver/migrations/0035_auto_20240919_2223.py rename to mcserver/migrations/0035_auto_20240918_2354.py index 5bc5f71..f31a82c 100644 --- a/mcserver/migrations/0035_auto_20240919_2223.py +++ b/mcserver/migrations/0035_auto_20240918_2354.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2 on 2024-09-19 22:23 +# Generated by Django 3.2 on 2024-09-18 23:54 from django.db import migrations, models @@ -12,14 +12,9 @@ class Migration(migrations.Migration): operations = [ migrations.AddField( model_name='trial', - name='hostname', + name='docker', field=models.CharField(blank=True, max_length=64, null=True), ), - migrations.AddField( - model_name='trial', - name='is_docker', - field=models.BooleanField(blank=True, null=True), - ), migrations.AddField( model_name='trial', name='processed_count', diff --git a/mcserver/migrations/0036_auto_20240919_2329.py b/mcserver/migrations/0036_auto_20240919_2329.py new file mode 100644 index 0000000..d307856 --- /dev/null +++ b/mcserver/migrations/0036_auto_20240919_2329.py @@ -0,0 +1,27 @@ +# Generated by Django 3.2 on 2024-09-19 23:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mcserver', '0035_auto_20240918_2354'), + ] + + operations = [ + migrations.RemoveField( + model_name='trial', + name='docker', + ), + migrations.AddField( + model_name='trial', + name='hostname', + field=models.CharField(blank=True, max_length=64, null=True), + ), + migrations.AddField( + model_name='trial', + name='is_docker', + field=models.BooleanField(blank=True, null=True), + ), + ] From cbf8b038725694ea991b7afc62842c9e108341f4 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Fri, 20 Sep 2024 14:51:57 -0700 Subject: [PATCH 04/17] minor: add missing import for F() --- mcserver/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mcserver/views.py b/mcserver/views.py index 702f3bc..55adc4a 100644 --- a/mcserver/views.py +++ b/mcserver/views.py @@ -21,6 +21,7 @@ from django.utils.translation import gettext as _ from django.http import FileResponse from django.db.models import Count +from django.db.models import F from django.views.decorators.csrf import csrf_exempt from django.conf import settings from django.core.mail import EmailMessage From bc9042fe3313e78d48dee5a5489c488eedd073f0 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Fri, 20 Sep 2024 15:46:05 -0700 Subject: [PATCH 05/17] use update with F() expression --- mcserver/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcserver/views.py b/mcserver/views.py index 55adc4a..259b9e2 100644 --- a/mcserver/views.py +++ b/mcserver/views.py @@ -1510,8 +1510,8 @@ def dequeue(self, request): trial.status = "processing" trial.server = ip trial.hostname = hostname - trial.processed_count = F("processed_count") + 1 trial.save() + trial.objects.update(processed_count=(F("processed_count") + 1)) print(ip) print(trial.session.server) From 09e45b5199efe373856b7f1bdc94b12f388ac6c4 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Fri, 20 Sep 2024 16:04:59 -0700 Subject: [PATCH 06/17] remove F() expression --- mcserver/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcserver/views.py b/mcserver/views.py index 259b9e2..51f02ad 100644 --- a/mcserver/views.py +++ b/mcserver/views.py @@ -1510,8 +1510,8 @@ def dequeue(self, request): trial.status = "processing" trial.server = ip trial.hostname = hostname + trial.processed_count += 1 trial.save() - trial.objects.update(processed_count=(F("processed_count") + 1)) print(ip) print(trial.session.server) From b2f2ead75db820e127ef378b178f8a8fa7bd16a2 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Tue, 24 Sep 2024 11:43:52 -0700 Subject: [PATCH 07/17] add git_commit and is_data_null. trim admin list view --- mcserver/admin.py | 6 +++++- mcserver/models.py | 1 + mcserver/serializers.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mcserver/admin.py b/mcserver/admin.py index 1b8672b..e8cbf82 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -101,13 +101,17 @@ class TrialAdmin(admin.ModelAdmin): 'session', 'status', 'created_at', 'updated_at', - 'server', 'is_docker', 'hostname', + 'server', 'git_commit' 'processed_duration', 'processed_count', + 'is_meta_null', 'trashed', 'trashed_at', ) raw_id_fields = ('session',) inlines = [ResultInline] + def is_meta_null(self, obj): + return obj.meta is None + @admin.register(Result) class ResultAdmin(admin.ModelAdmin): diff --git a/mcserver/models.py b/mcserver/models.py index 01a2af7..aad879e 100644 --- a/mcserver/models.py +++ b/mcserver/models.py @@ -113,6 +113,7 @@ class Trial(models.Model): hostname = models.CharField(max_length=64, null=True, blank=True) processed_duration = models.DurationField(null=True, blank=True) processed_count = models.IntegerField(default=0) + git_commit = models.CharField(max_length=64, null=True, blank=True) trashed = models.BooleanField(default=False) trashed_at = models.DateTimeField(blank=True, null=True) diff --git a/mcserver/serializers.py b/mcserver/serializers.py index a69a818..9d8e810 100644 --- a/mcserver/serializers.py +++ b/mcserver/serializers.py @@ -154,6 +154,7 @@ class Meta: 'results', 'meta', 'created_at', 'updated_at', 'server', 'is_docker', 'hostname', 'processed_duration', 'processed_count', + 'git_commit', 'trashed', 'trashed_at', ] From 9a9cf2b045ea34c3ad9c4c803670fa8e3b2c1bfb Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Tue, 24 Sep 2024 11:47:23 -0700 Subject: [PATCH 08/17] fix migrations --- mcserver/admin.py | 2 +- mcserver/migrations/0037_trial_git_commit.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 mcserver/migrations/0037_trial_git_commit.py diff --git a/mcserver/admin.py b/mcserver/admin.py index e8cbf82..33e6a6b 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -101,7 +101,7 @@ class TrialAdmin(admin.ModelAdmin): 'session', 'status', 'created_at', 'updated_at', - 'server', 'git_commit' + 'server', 'git_commit', 'processed_duration', 'processed_count', 'is_meta_null', 'trashed', 'trashed_at', diff --git a/mcserver/migrations/0037_trial_git_commit.py b/mcserver/migrations/0037_trial_git_commit.py new file mode 100644 index 0000000..3786e29 --- /dev/null +++ b/mcserver/migrations/0037_trial_git_commit.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2 on 2024-09-24 18:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mcserver', '0036_auto_20240919_2329'), + ] + + operations = [ + migrations.AddField( + model_name='trial', + name='git_commit', + field=models.CharField(blank=True, max_length=64, null=True), + ), + ] From ad97dd1f2d1ed349f5e8843a03aa7290a796def2 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Mon, 30 Sep 2024 17:36:18 -0700 Subject: [PATCH 09/17] don't get client hostname from server side --- mcserver/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mcserver/views.py b/mcserver/views.py index 51f02ad..1cc52ca 100644 --- a/mcserver/views.py +++ b/mcserver/views.py @@ -1455,7 +1455,6 @@ class TrialViewSet(viewsets.ModelViewSet): def dequeue(self, request): try: ip = get_client_ip(request) - hostname = get_client_hostname(request) workerType = self.request.query_params.get('workerType') From b5ea7e12b70ca565f889bef0ccb4d56c0bf72734 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Tue, 1 Oct 2024 10:43:03 -0700 Subject: [PATCH 10/17] reduce processed fields clutter in list view --- mcserver/admin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mcserver/admin.py b/mcserver/admin.py index 33e6a6b..0fe0a72 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -19,6 +19,7 @@ from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin, GroupAdmin from django.contrib.admin.models import LogEntry +from datetime import timedelta #admin.site.unregister(Group) @@ -102,16 +103,23 @@ class TrialAdmin(admin.ModelAdmin): 'status', 'created_at', 'updated_at', 'server', 'git_commit', - 'processed_duration', 'processed_count', + 'formatted_duration', 'processed_count', 'is_meta_null', 'trashed', 'trashed_at', ) raw_id_fields = ('session',) inlines = [ResultInline] + formatted_duration.short_description = 'duration' + processed_count.short_description = 'count' def is_meta_null(self, obj): return obj.meta is None + def formatted_duration(self, obj): + hours, remainder = divmod(int(obj.duration.total_seconds()), 3600) + minutes, seconds = divmod(remainder, 60) + return f"{hours:02}:{minutes:02}:{seconds:02}" + @admin.register(Result) class ResultAdmin(admin.ModelAdmin): From 8d49388eb88c6ab43950584723f2dc8096a5f2bc Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Tue, 1 Oct 2024 16:47:31 -0700 Subject: [PATCH 11/17] move formatted_duration after definition --- mcserver/admin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mcserver/admin.py b/mcserver/admin.py index 0fe0a72..9e0a2a2 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -109,8 +109,6 @@ class TrialAdmin(admin.ModelAdmin): ) raw_id_fields = ('session',) inlines = [ResultInline] - formatted_duration.short_description = 'duration' - processed_count.short_description = 'count' def is_meta_null(self, obj): return obj.meta is None @@ -120,6 +118,9 @@ def formatted_duration(self, obj): minutes, seconds = divmod(remainder, 60) return f"{hours:02}:{minutes:02}:{seconds:02}" + formatted_duration.short_description = 'duration' + processed_count.short_description = 'count' + @admin.register(Result) class ResultAdmin(admin.ModelAdmin): From e62c34ba330c34b65bc042c03abb09754d9ce3a7 Mon Sep 17 00:00:00 2001 From: Alberto Casas Ortiz Date: Wed, 2 Oct 2024 11:10:46 -0700 Subject: [PATCH 12/17] Added processed_count function. --- mcserver/admin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mcserver/admin.py b/mcserver/admin.py index 9e0a2a2..8fff00a 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -118,6 +118,9 @@ def formatted_duration(self, obj): minutes, seconds = divmod(remainder, 60) return f"{hours:02}:{minutes:02}:{seconds:02}" + def processed_count(self, obj): + return obj.processed_count + formatted_duration.short_description = 'duration' processed_count.short_description = 'count' From e0889c9259055e58c785fd2ba186607e29bc7917 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Wed, 2 Oct 2024 11:58:36 -0700 Subject: [PATCH 13/17] fix with actually field name processed_duration --- mcserver/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcserver/admin.py b/mcserver/admin.py index 8fff00a..1eff2b2 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -114,7 +114,7 @@ def is_meta_null(self, obj): return obj.meta is None def formatted_duration(self, obj): - hours, remainder = divmod(int(obj.duration.total_seconds()), 3600) + hours, remainder = divmod(int(obj.processed_duration.total_seconds()), 3600) minutes, seconds = divmod(remainder, 60) return f"{hours:02}:{minutes:02}:{seconds:02}" From 4462afe7696374ceb6441706032bfbe89e56a46b Mon Sep 17 00:00:00 2001 From: Alberto Casas Ortiz Date: Wed, 2 Oct 2024 16:00:38 -0700 Subject: [PATCH 14/17] Checking if processed_duration is undefined. --- mcserver/admin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mcserver/admin.py b/mcserver/admin.py index 1eff2b2..aa1bd65 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -114,9 +114,12 @@ def is_meta_null(self, obj): return obj.meta is None def formatted_duration(self, obj): - hours, remainder = divmod(int(obj.processed_duration.total_seconds()), 3600) - minutes, seconds = divmod(remainder, 60) - return f"{hours:02}:{minutes:02}:{seconds:02}" + if obj.processed_duration: + hours, remainder = divmod(int(obj.processed_duration.total_seconds()), 3600) + minutes, seconds = divmod(remainder, 60) + return f"{hours:02}:{minutes:02}:{seconds:02}" + else: + return obj.processed_duration def processed_count(self, obj): return obj.processed_count From 17f205f250d94f5e1b98f9d04a59c188a557e7c4 Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Thu, 3 Oct 2024 14:32:35 -0700 Subject: [PATCH 15/17] fix processed_count -> count in admin list --- mcserver/admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mcserver/admin.py b/mcserver/admin.py index aa1bd65..f386646 100644 --- a/mcserver/admin.py +++ b/mcserver/admin.py @@ -103,7 +103,7 @@ class TrialAdmin(admin.ModelAdmin): 'status', 'created_at', 'updated_at', 'server', 'git_commit', - 'formatted_duration', 'processed_count', + 'formatted_duration', 'formatted_count', 'is_meta_null', 'trashed', 'trashed_at', ) @@ -121,11 +121,11 @@ def formatted_duration(self, obj): else: return obj.processed_duration - def processed_count(self, obj): + def formatted_count(self, obj): return obj.processed_count formatted_duration.short_description = 'duration' - processed_count.short_description = 'count' + formatted_count.short_description = 'count' @admin.register(Result) From 50b2de5b7dea38b3722bb6c2e16d7c8223466f57 Mon Sep 17 00:00:00 2001 From: Alberto Casas Ortiz Date: Thu, 3 Oct 2024 16:32:09 -0700 Subject: [PATCH 16/17] Fixing problem with exceptions in dequeue. It was always raising 404. --- mcserver/views.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mcserver/views.py b/mcserver/views.py index 1cc52ca..7c14bab 100644 --- a/mcserver/views.py +++ b/mcserver/views.py @@ -1521,10 +1521,9 @@ def dequeue(self, request): serializer = TrialSerializer(trial, many=False) - + except Http404: + raise Http404 # we use the 404 to tell app.py that there are no trials, so need to pass this thru except Exception: - if Http404: # we use the 404 to tell app.py that there are no trials, so need to pass this thru - raise Http404 if settings.DEBUG: raise APIException(_("error") % {"error_message": str(traceback.format_exc())}) raise APIException(_('trial_dequeue_error')) From cd6995dd2e4633207e7b3404c619fb088fb32b1d Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Thu, 3 Oct 2024 16:34:26 -0700 Subject: [PATCH 17/17] don't update hostname from api side --- mcserver/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mcserver/views.py b/mcserver/views.py index 1cc52ca..730e4ee 100644 --- a/mcserver/views.py +++ b/mcserver/views.py @@ -1508,7 +1508,6 @@ def dequeue(self, request): trial = trialsPrioritized[0] trial.status = "processing" trial.server = ip - trial.hostname = hostname trial.processed_count += 1 trial.save()