Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compute_worker/compute_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import websockets
import yaml
from billiard.exceptions import SoftTimeLimitExceeded
from celery import Celery, task
from celery import Celery, task, utils
from kombu import Queue, Exchange
from urllib3 import Retry

Expand Down Expand Up @@ -309,6 +309,7 @@ def _update_submission(self, data):
def _update_status(self, status, extra_information=None):
if status not in AVAILABLE_STATUSES:
raise SubmissionException(f"Status '{status}' is not in available statuses: {AVAILABLE_STATUSES}")

data = {
"status": status,
"status_details": extra_information,
Expand Down Expand Up @@ -663,8 +664,9 @@ def prepare(self):
self._get_container_image(self.container_image)

def start(self):
hostname = utils.nodenames.gethostname()
if not self.is_scoring:
self._update_status(STATUS_RUNNING)
self._update_status(STATUS_RUNNING, extra_information=f"hostname-{hostname}")

program_dir = os.path.join(self.root_dir, "program")
ingestion_program_dir = os.path.join(self.root_dir, "ingestion_program")
Expand Down
7 changes: 7 additions & 0 deletions src/apps/api/views/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ def check_object_permissions(self, request, obj):
raise PermissionDenied("Cannot add task-specific submission re-runs to leaderboards.")
return
if self.request and self.request.method in ('POST', 'PUT', 'PATCH'):
dir(self.request)
# Set hostname of submission
if "status_details" in self.request.data.keys():
if request.data['status_details'].find('hostname') != -1:
hostname = request.data['status_details'].replace('hostname-', '')
obj.worker_hostname = hostname
obj.save()
not_bot_user = self.request.user.is_authenticated and not self.request.user.is_bot

if self.action in ['update_fact_sheet', 're_run_submission']:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.17 on 2023-05-09 04:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('competitions', '0031_auto_20230504_1016'),
]

operations = [
migrations.AddField(
model_name='submission',
name='worker_hostname',
field=models.CharField(blank=True, max_length=255, null=True),
),
]
2 changes: 1 addition & 1 deletion src/apps/competitions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ class Submission(ChaHubSaveMixin, models.Model):
started_when = models.DateTimeField(null=True)
is_public = models.BooleanField(default=False)
is_specific_task_re_run = models.BooleanField(default=False)

worker_hostname = models.CharField(max_length=255, blank=True, null=True)
is_migrated = models.BooleanField(default=False)
created_by_migration = models.ForeignKey(Phase, related_name='migrated_submissions', on_delete=models.CASCADE,
null=True,
Expand Down
2 changes: 2 additions & 0 deletions src/templates/pages/server_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Recent submissions (up to 250 or 2 days old)</h1>
<th>Competition</th>
<th>Submission PK</th>
<th>Submitter</th>
<th>Hostname</th>
<th>Submitted at</th>
<th>Status</th>
</thead>
Expand All @@ -26,6 +27,7 @@ <h1>Recent submissions (up to 250 or 2 days old)</h1>
<td>{{ submission.phase.competition }}</td>
<td>{{ submission.pk }}</td>
<td>{{ submission.owner.username }}</td>
<td>{{ submission.worker_hostname }}</td>
<td>{{ submission.created_when|timesince }} ago</td>
<td>{{ submission.status }}</td>
</tr>
Expand Down