示例#1
0
class Event(ObraModel):
    """
    A single race day - may be standalone or part of a series.
    """
    id = IntegerField(verbose_name='Event ID', primary_key=True)
    name = CharField(verbose_name='Event Name')
    discipline = CharField(verbose_name='Event Discipline', index=True)
    year = IntegerField(verbose_name='Event Year')
    date = CharField(verbose_name='Event Month/Day')
    series = ForeignKeyField(verbose_name='Event Series',
                             model=Series,
                             backref='events',
                             on_update='RESTRICT',
                             on_delete='RESTRICT',
                             null=True)
    parent = ForeignKeyField(verbose_name='Child Events',
                             model='self',
                             backref='children',
                             on_update='RESTRICT',
                             on_delete='RESTRICT',
                             null=True)
    ignore = BooleanField(verbose_name='Ignore/Hide Event', default=False)

    @property
    def discipline_title(self):
        return self.discipline.replace('_', ' ').title()
示例#2
0
class Parameter(BaseModel):
    group = ForeignKeyField(ParameterGroup, backref="parameters")
    key = CharField()
    value = CharField()

    class Meta:
        primary_key = CompositeKey("group", "key")
示例#3
0
class Run(BaseModel):
    FAILED = -2
    CANCELED = -1
    PENDING = 0
    SUBMITTED = 1
    RUNNING = 2
    DONE = 3

    STATUS_CHOICES = (
        (FAILED, "Failed"),
        (CANCELED, "Canceled"),
        (PENDING, "Pending"),
        (SUBMITTED, "Submitted"),
        (RUNNING, "Running"),
        (DONE, "Done"),
    )

    id = CharField(null=True, primary_key=True)
    created_at = DateTimeField(default=datetime.now)
    tool = ForeignKeyField(Tool, backref="runs")
    tool_version = CharField(null=True)
    parameter_group = ForeignKeyField(ParameterGroup, backref="runs")
    task = ForeignKeyField(Task, backref="runs")
    status = IntegerField(choices=STATUS_CHOICES, default=PENDING)
    last_step = ForeignKeyField(Step, null=True)
    iteration = IntegerField(default=0)
示例#4
0
class Person(ObraModel):
    """
    A person who participated in a race.
    """
    id = IntegerField(verbose_name='Person ID', primary_key=True)
    first_name = CharField(verbose_name='First Name')
    last_name = CharField(verbose_name='Last Name')
    team_name = CharField(verbose_name='Team Name', default='')
示例#5
0
class Series(ObraModel):
    """
    An OBRA race series spanning multiple events over more than one day.
    """
    id = IntegerField(verbose_name='Series ID', primary_key=True)
    name = CharField(verbose_name='Series Name')
    year = IntegerField(verbose_name='Series Year')
    dates = CharField(verbose_name='Series Months/Days')
示例#6
0
class Node(BaseModel):
    hostname = CharField(primary_key=True)
    platform = CharField(null=True)
    arch = CharField(null=True)
    python = CharField(null=True)
    cpu = CharField(null=True)
    cpu_count = IntegerField(null=True)
    cpu_min_freq = FloatField(null=True)
    cpu_max_freq = FloatField(null=True)
    mem_total = IntegerField(null=True)
    mem_available = IntegerField(null=True)
    swap_total = IntegerField(null=True)
    swap_available = IntegerField(null=True)
示例#7
0
class Step(BasePlugin):
    RUN = "run"
    ANALYSIS = "analysis"

    CATEGORY_CHOICES = ((RUN, "Single run step"), (ANALYSIS, "Analysis step"))

    category = CharField(choices=CATEGORY_CHOICES, index=True)
示例#8
0
class RunStatistic(BaseModel):
    TIMEOUT = "TLE"
    MEMOUT = "MEM"
    RUNTIME_ERR = "RTE"
    OUTPUT_LIMIT = "OLE"
    SUCCESS = "OK"

    VERDICT_CHOICES = (
        (TIMEOUT, "Time Limit Exceeded"),
        (MEMOUT, "Memory Limit Exceeded"),
        (RUNTIME_ERR, "Runtime Error"),
        (OUTPUT_LIMIT, "Output Limit Exceeded"),
        (SUCCESS, "Run Successfully"),
    )

    created_at = DateTimeField(default=datetime.now)
    run = ForeignKeyField(Run,
                          backref="statistics",
                          on_delete="cascade",
                          primary_key=True)
    cpu_time = FloatField(help_text="CPU Time (s)", null=True)
    wall_time = FloatField(help_text="Wall Clock Time (s)", null=True)
    max_memory = FloatField(help_text="Max Memory Usage (KiB)", null=True)
    return_code = IntegerField(help_text="Process Return Code", null=True)
    verdict = CharField(choices=VERDICT_CHOICES, max_length=3, null=True)
示例#9
0
class Points(ObraModel):
    """
    Points toward a category upgrade - awarded for a good Result in a Race of a specific size.
    """
    result = ForeignKeyField(verbose_name='Result awarding Upgrade Points',
                             model=Result,
                             backref='points',
                             on_update='RESTRICT',
                             on_delete='RESTRICT',
                             primary_key=True)
    value = CharField(verbose_name='Points Earned for Result', default='0')
    notes = CharField(verbose_name='Notes', default='')
    needs_upgrade = BooleanField(verbose_name='Needs Upgrade', default=False)
    upgrade_confirmation = ForeignKeyField(
        verbose_name='Member Data Confirming Upgrade',
        model=ObraPersonSnapshot,
        backref='points',
        null=True)
    sum_value = IntegerField(verbose_name='Current Points Sum', default=0)
    sum_categories = JSONField(verbose_name='Current Category', default=[])
示例#10
0
class PendingUpgrade(ObraModel):
    result = ForeignKeyField(verbose_name='Result with Pending Upgrade',
                             model=Result,
                             backref='pending',
                             on_update='RESTRICT',
                             on_delete='RESTRICT',
                             primary_key=True)
    upgrade_confirmation = ForeignKeyField(
        verbose_name='Member Data Confirming Upgrade',
        model=ObraPersonSnapshot,
        backref='pending',
        on_update='RESTRICT',
        on_delete='RESTRICT')
    discipline = CharField(verbose_name='Upgrade Discipline', index=True)
示例#11
0
class Race(ObraModel):
    """
    A single race at an event, with one or more results.
    """
    id = IntegerField(verbose_name='Race ID', primary_key=True)
    name = CharField(verbose_name='Race Name', index=True)
    date = DateField(verbose_name='Race Date')
    categories = JSONField(verbose_name='Race Categories')
    starters = IntegerField(verbose_name='Race Starting Field Size', default=0)
    created = DateTimeField(verbose_name='Results Created')
    updated = DateTimeField(verbose_name='Results Updated')
    event = ForeignKeyField(verbose_name='Race Event',
                            model=Event,
                            backref='races',
                            on_update='RESTRICT',
                            on_delete='RESTRICT')
示例#12
0
class Result(ObraModel):
    """
    An individual race result - a Person's place in a specific Race.
    """
    id = IntegerField(verbose_name='Result ID', primary_key=True)
    race = ForeignKeyField(verbose_name='Result Race',
                           model=Race,
                           backref='results',
                           on_update='RESTRICT',
                           on_delete='RESTRICT')
    person = ForeignKeyField(verbose_name='Result Person',
                             model=Person,
                             backref='results',
                             on_update='RESTRICT',
                             on_delete='RESTRICT',
                             null=True)
    place = CharField(verbose_name='Place', index=True)
    time = IntegerField(verbose_name='Time', null=True)
    laps = IntegerField(verbose_name='Laps', null=True)
示例#13
0
文件: db.py 项目: fossabot/reprobench
class Tool(BaseModel):
    module = CharField(primary_key=True)
    name = CharField()
    version = CharField(null=True)
示例#14
0
class BasePlugin(BaseModel):
    module = CharField(index=True)
    config = TextField()
示例#15
0
class ParameterGroup(BaseModel):
    name = CharField()
    tool = ForeignKeyField(Tool, backref="parameter_groups")

    class Meta:
        indexes = ((("name", "tool"), True), )
示例#16
0
class Tool(BaseModel):
    module = CharField()
    name = CharField(primary_key=True)
示例#17
0
class Task(BaseModel):
    group = ForeignKeyField(TaskGroup, backref="tasks")
    path = CharField(primary_key=True)
示例#18
0
class TaskGroup(BaseModel):
    name = CharField(primary_key=True)
示例#19
0
class Limit(BaseModel):
    key = CharField(max_length=32, primary_key=True)
    value = CharField()