コード例 #1
0
ファイル: models.py プロジェクト: cytadela8/oioioi
import os

from django.db import models
from django.utils.translation import ugettext_lazy as _

from oioioi.base.utils.deps import check_django_app_dependencies
from oioioi.contests.models import submission_statuses
from oioioi.problems.models import Problem
from oioioi.programs.models import TestReport

check_django_app_dependencies(__name__, ['oioioi.testrun'], strict=True)


submission_statuses.register('MSE', _("Outgoing message size limit exceeded"))
submission_statuses.register('MCE', _("Outgoing message count limit exceeded"))


class ZeusProblemData(models.Model):
    problem = models.OneToOneField(Problem, primary_key=True)
    zeus_id = models.CharField(max_length=255)
    zeus_problem_id = models.IntegerField(default=0)


def make_custom_library_filename(instance, filename):
    if not instance.id:
        instance.save()
    return 'testruns/%s/%d/lib%s' % (instance.problem_instance.contest.id,
            instance.id, os.path.splitext(filename)[1])


class ZeusTestReport(TestReport):
コード例 #2
0
ファイル: models.py プロジェクト: pragacz/oioioi
            self.source_length = self.source_file.size
        super(ProgramSubmission, self).save(*args, **kwargs)

    @property
    def extension(self):
        return os.path.splitext(self.source_file.name)[1][1:]

    def get_language_display(self):
        return get_language_by_extension(self.problem_instance, self.extension)


class ModelProgramSubmission(ProgramSubmission):
    model_solution = models.ForeignKey(ModelSolution, on_delete=models.CASCADE)


submission_statuses.register('CE', _("Compilation failed"))
submission_statuses.register('RE', _("Runtime error"))
submission_statuses.register('WA', _("Wrong answer"))
submission_statuses.register('TLE', _("Time limit exceeded"))
submission_statuses.register('MLE', _("Memory limit exceeded"))
submission_statuses.register('OLE', _("Output limit exceeded"))
submission_statuses.register('SE', _("System error"))
submission_statuses.register('RV', _("Rule violation"))

submission_statuses.register('INI_OK', _("Initial tests: OK"))
submission_statuses.register('INI_ERR', _("Initial tests: failed"))

submission_kinds.register('USER_OUTS', _("Generate user out"))

submission_report_kinds.register('INITIAL', _("Initial report"))
submission_report_kinds.register('NORMAL', _("Normal report"))
コード例 #3
0
ファイル: models.py プロジェクト: sio2project/oioioi
from django.utils.translation import ugettext_lazy as _

from oioioi.base.utils.deps import check_django_app_dependencies
from oioioi.contests.models import submission_statuses

check_django_app_dependencies(__name__, ['oioioi.participants'])


submission_statuses.register('IGN', _("Ignored"))
コード例 #4
0
from django.utils.translation import ugettext_lazy as _

from oioioi.base.utils.deps import check_django_app_dependencies
from oioioi.contests.models import submission_statuses

check_django_app_dependencies(__name__, ['oioioi.participants'])

submission_statuses.register('IGN', _("Ignored"))
コード例 #5
0
from nose.tools import nottest
from django.conf import settings
from django.db import models
from oioioi.contests.models import submission_kinds, SubmissionReport, \
    submission_statuses, submission_report_kinds
from django.utils.translation import ugettext_lazy as _
from oioioi.programs.models import ProgramSubmission
from oioioi.filetracker.fields import FileField
from oioioi.base.fields import EnumField
from oioioi.problems.models import Problem, ProblemInstance

submission_statuses.register('TESTRUN_OK', _("No error"))
submission_kinds.register('TESTRUN', _("Test run"))
submission_report_kinds.register('TESTRUN', _("Test run report"))


@nottest
class TestRunConfig(models.Model):
    """Represents a test run config for problem.

       Test run for program is enabled iff this model exits.
    """
    problem = models.OneToOneField(Problem,
                        verbose_name=_("problem"),
                        related_name='test_run_config')

    time_limit = models.IntegerField(verbose_name=_("time limit (ms)"),
            null=True, blank=True)
    memory_limit = models.IntegerField(verbose_name=_("memory limit (KiB)"),
            null=True, blank=True)
コード例 #6
0
ファイル: models.py プロジェクト: papedaniel/oioioi
from django.db import models
from django.utils.translation import ugettext_lazy as _

from oioioi.base.utils.deps import check_django_app_dependencies
from oioioi.contests.models import submission_statuses
from oioioi.filetracker.fields import FileField
from oioioi.problems.models import Problem
from oioioi.testrun.models import TestRunReport, TestRunProgramSubmission


check_django_app_dependencies(__name__, ['oioioi.testrun'], strict=True)
check_django_app_dependencies(__name__, ['oioioi.submitsqueue'])


submission_statuses.register('MSE', _("Outgoing message size limit exceeded"))
submission_statuses.register('MCE', _("Outgoing message count limit exceeded"))


class ZeusProblemData(models.Model):
    problem = models.OneToOneField(Problem, primary_key=True)
    zeus_id = models.CharField(max_length=255)
    zeus_problem_id = models.IntegerField(default=0)


class ZeusAsyncJob(models.Model):
    check_uid = models.IntegerField(primary_key=True)
    environ = models.TextField()
    resumed = models.BooleanField(default=False)

コード例 #7
0
ファイル: models.py プロジェクト: sio2project/oioioi
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _

from oioioi.base.fields import EnumField
from oioioi.contests.models import (SubmissionReport, submission_kinds,
                                    submission_report_kinds,
                                    submission_statuses)
from oioioi.filetracker.fields import FileField
from oioioi.problems.models import Problem, ProblemInstance
from oioioi.programs.models import ProgramSubmission

submission_statuses.register('TESTRUN_OK', _("No error"))
submission_kinds.register('TESTRUN', _("Test run"))
submission_report_kinds.register('TESTRUN', _("Test run report"))


class TestRunConfig(models.Model):
    """Represents a test run config for problem.

       Test run for program is enabled iff this model exits.
    """
    __test__ = False
    problem = models.OneToOneField(Problem,
                                   verbose_name=_("problem"),
                                   related_name='test_run_config',
                                   on_delete=models.CASCADE)

    time_limit = models.IntegerField(verbose_name=_("time limit (ms)"),
            null=True, blank=True)
    memory_limit = models.IntegerField(verbose_name=_("memory limit (KiB)"),
コード例 #8
0
ファイル: models.py プロジェクト: mahrud/oioioi
        for pi in pis:
            ModelSolution.objects.recreate_model_submissions(pi)

def make_submission_filename(instance, filename):
    if not instance.id:
        instance.save()
    return 'submissions/%s/%d%s' % (instance.problem_instance.contest.id,
            instance.id, os.path.splitext(filename)[1])

class ProgramSubmission(Submission):
    source_file = FileField(upload_to=make_submission_filename)

class ModelProgramSubmission(ProgramSubmission):
    model_solution = models.ForeignKey(ModelSolution)

submission_statuses.register('CE', _("Compilation failed"))
submission_statuses.register('RE', _("Runtime error"))
submission_statuses.register('WA', _("Wrong answer"))
submission_statuses.register('TLE', _("Time limit exceeded"))
submission_statuses.register('MLE', _("Memory limit exceeded"))
submission_statuses.register('SE', _("System error"))
submission_statuses.register('SV', _("Security violation"))

submission_report_kinds.register('INITIAL', _("Initial report"))
submission_report_kinds.register('HIDDEN', _("Hidden report (for admins only)"))

class CompilationReport(models.Model):
    submission_report = models.ForeignKey(SubmissionReport)
    status = EnumField(submission_statuses)
    compiler_output = models.TextField()
コード例 #9
0
ファイル: models.py プロジェクト: sio2project/oioioi
        if self.source_file:
            self.source_length = self.source_file.size
        super(ProgramSubmission, self).save(*args, **kwargs)

    @property
    def extension(self):
        return os.path.splitext(self.source_file.name)[1][1:]

    def get_language_display(self):
        return get_language_by_extension(self.problem_instance, self.extension)


class ModelProgramSubmission(ProgramSubmission):
    model_solution = models.ForeignKey(ModelSolution, on_delete=models.CASCADE)

submission_statuses.register('CE', _("Compilation failed"))
submission_statuses.register('RE', _("Runtime error"))
submission_statuses.register('WA', _("Wrong answer"))
submission_statuses.register('TLE', _("Time limit exceeded"))
submission_statuses.register('MLE', _("Memory limit exceeded"))
submission_statuses.register('OLE', _("Output limit exceeded"))
submission_statuses.register('SE', _("System error"))
submission_statuses.register('RV', _("Rule violation"))

submission_statuses.register('INI_OK', _("Initial tests: OK"))
submission_statuses.register('INI_ERR', _("Initial tests: failed"))

submission_kinds.register('USER_OUTS', _("Generate user out"))

submission_report_kinds.register('INITIAL', _("Initial report"))
submission_report_kinds.register('NORMAL', _("Normal report"))
コード例 #10
0
        for pi in pis:
            ModelSolution.objects.recreate_model_submissions(pi)

def make_submission_filename(instance, filename):
    if not instance.id:
        instance.save()
    return 'submissions/%s/%d%s' % (instance.problem_instance.contest.id,
            instance.id, os.path.splitext(filename)[1])

class ProgramSubmission(Submission):
    source_file = FileField(upload_to=make_submission_filename)

class ModelProgramSubmission(ProgramSubmission):
    model_solution = models.ForeignKey(ModelSolution)

submission_statuses.register('CE', _("Compilation failed"))
submission_statuses.register('RE', _("Runtime error"))
submission_statuses.register('WA', _("Wrong answer"))
submission_statuses.register('TLE', _("Time limit exceeded"))
submission_statuses.register('MLE', _("Memory limit exceeded"))
submission_statuses.register('SE', _("System error"))
submission_statuses.register('SV', _("Security violation"))

submission_report_kinds.register('INITIAL', _("Initial report"))
submission_report_kinds.register('HIDDEN', _("Hidden report (for admins only)"))

class CompilationReport(models.Model):
    submission_report = models.ForeignKey(SubmissionReport)
    status = EnumField(submission_statuses)
    compiler_output = models.TextField()