Skip to content

Commit

Permalink
Add tier field to judge model
Browse files Browse the repository at this point in the history
  • Loading branch information
quantum5 committed Aug 21, 2024
1 parent 8cebced commit f47f843
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion judge/admin/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class JudgeAdmin(VersionAdmin):
readonly_fields = ('created', 'online', 'start_time', 'ping', 'load', 'last_ip', 'runtimes', 'problems',
'is_disabled')
fieldsets = (
(None, {'fields': ('name', 'auth_key', 'is_blocked', 'is_disabled')}),
(None, {'fields': ('name', 'auth_key', 'is_blocked', 'is_disabled', 'tier')}),
(_('Description'), {'fields': ('description',)}),
(_('Information'), {'fields': ('created', 'online', 'last_ip', 'start_time', 'ping', 'load')}),
(_('Capabilities'), {'fields': ('runtimes',)}),
Expand Down
19 changes: 19 additions & 0 deletions judge/migrations/0147_judge_add_tiers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
('judge', '0146_comment_revision_count_v2'),
]

operations = [
migrations.AddField(
model_name='judge',
name='tier',
field=models.PositiveIntegerField(
default=1,
help_text='The tier of this judge. Only online judges of the minimum tier will be used. This is used for high-availability.',
verbose_name='judge tier'
),
),
]
3 changes: 3 additions & 0 deletions judge/models/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ class Judge(models.Model):
'even if its key is correct.'))
is_disabled = models.BooleanField(verbose_name=_('disable judge'), default=False,
help_text=_('Whether this judge should be removed from judging queue.'))
tier = models.PositiveIntegerField(verbose_name=_('judge tier'), default=1,
help_text=_('The tier of this judge. Only online judges of the minimum tier '
'will be used. This is used for high-availability.'))
online = models.BooleanField(verbose_name=_('judge online status'), default=False)
start_time = models.DateTimeField(verbose_name=_('judge start time'), null=True)
ping = models.FloatField(verbose_name=_('response time'), null=True)
Expand Down

0 comments on commit f47f843

Please sign in to comment.