Skip to content

Commit 000e7e8

Browse files
authored
Merge branch 'main' into add-counter
2 parents 1b0b0a1 + 4486dc1 commit 000e7e8

26 files changed

Lines changed: 613 additions & 1028 deletions

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ RUN <<EOF
6363
#!/bin/bash -ex
6464
# Need to set user ID manually: otherwise it'd be 1000 on debian
6565
# and 1001 on ubuntu.
66-
useradd -ms /bin/bash -u 1001 cmsuser
66+
# 1001 is taken by `isolate`.
67+
useradd -ms /bin/bash -u 2000 cmsuser
6768
usermod -aG sudo cmsuser
6869
usermod -aG isolate cmsuser
6970
# Disable sudo password
@@ -79,12 +80,12 @@ COPY --chown=cmsuser:cmsuser install.py constraints.txt /home/cmsuser/src/
7980

8081
WORKDIR /home/cmsuser/src
8182

82-
RUN --mount=type=cache,target=/home/cmsuser/.cache/pip,uid=1001 ./install.py venv
83+
RUN --mount=type=cache,target=/home/cmsuser/.cache/pip,uid=2000 ./install.py venv
8384
ENV PATH="/home/cmsuser/cms/bin:$PATH"
8485

8586
COPY --chown=cmsuser:cmsuser . /home/cmsuser/src
8687

87-
RUN --mount=type=cache,target=/home/cmsuser/.cache/pip,uid=1001 ./install.py cms --devel
88+
RUN --mount=type=cache,target=/home/cmsuser/.cache/pip,uid=2000 ./install.py cms --devel
8889

8990
RUN <<EOF
9091
#!/bin/bash -ex

cms/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ class Config:
184184
services: dict[ServiceCoord, Address] = dataclasses.field(init=False)
185185

186186
def __post_init__(self):
187+
if self.sandbox.sandbox_implementation != "isolate":
188+
logger.warning("The 'sandbox_implementation' configuration option "
189+
"is deprecated and only 'isolate' is supported. "
190+
"Ignoring provided value '%s'.",
191+
self.sandbox.sandbox_implementation)
192+
187193
self.services = {}
188194
for service_name, instances in self.services_.items():
189195
for shard_number, shard in enumerate(instances):

cms/db/submission.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,9 @@ class Evaluation(Base):
766766
nullable=False,
767767
default=[])
768768

769+
# Admin-facing output from the grader.
770+
admin_text: str | None = Column(String, nullable=True, default=None)
771+
769772
# Evaluation's time and wall-clock time, in seconds.
770773
execution_time: float | None = Column(
771774
Float,

cms/grading/Job.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def __init__(
9393
info: str | None = None,
9494
success: bool | None = None,
9595
text: list[str] | None = None,
96+
admin_text: str | None = None,
9697
files: dict[str, File] | None = None,
9798
managers: dict[str, Manager] | None = None,
9899
executables: dict[str, Executable] | None = None,
@@ -121,6 +122,8 @@ def __init__(
121122
to be presented to the user. The first item is a string,
122123
potentially with %-escaping; the following items are the
123124
values to be %-formatted into the first.
125+
admin_text: description of the outcome of the job,
126+
to be shown to admins.
124127
files: files submitted by the user.
125128
managers: managers provided by the admins.
126129
executables: executables created in the compilation.
@@ -155,6 +158,7 @@ def __init__(
155158

156159
self.success = success
157160
self.text = text
161+
self.admin_text = admin_text
158162

159163
self.files = files
160164
self.managers = managers
@@ -178,6 +182,7 @@ def export_to_dict(self) -> dict:
178182
'info': self.info,
179183
'success': self.success,
180184
'text': self.text,
185+
'admin_text': self.admin_text,
181186
'files': dict((k, v.digest)
182187
for k, v in self.files.items()),
183188
'managers': dict((k, v.digest)
@@ -316,6 +321,7 @@ def __init__(
316321
compilation_success: bool | None = None,
317322
executables: dict[str, Executable] | None = None,
318323
text: list[str] | None = None,
324+
admin_text: str | None = None,
319325
plus: dict | None = None,
320326
):
321327
"""Initialization.
@@ -331,7 +337,7 @@ def __init__(
331337
Job.__init__(self, operation, task_type, task_type_parameters,
332338
language, multithreaded_sandbox, archive_sandbox,
333339
shard, keep_sandbox, sandboxes, sandbox_digests, info, success,
334-
text, files, managers, executables)
340+
text, admin_text, files, managers, executables)
335341
self.compilation_success = compilation_success
336342
self.plus = plus
337343

@@ -537,6 +543,7 @@ def __init__(
537543
success: bool | None = None,
538544
outcome: str | None = None,
539545
text: list[str] | None = None,
546+
admin_text: str | None = None,
540547
user_output: str | None = None,
541548
plus: dict | None = None,
542549
only_execution: bool | None = False,
@@ -567,7 +574,7 @@ def __init__(
567574
Job.__init__(self, operation, task_type, task_type_parameters,
568575
language, multithreaded_sandbox, archive_sandbox,
569576
shard, keep_sandbox, sandboxes, sandbox_digests, info, success,
570-
text, files, managers, executables)
577+
text, admin_text, files, managers, executables)
571578
self.input = input
572579
self.output = output
573580
self.time_limit = time_limit
@@ -653,6 +660,7 @@ def to_submission(self, sr: SubmissionResult):
653660

654661
sr.evaluations += [Evaluation(
655662
text=self.text,
663+
admin_text=self.admin_text,
656664
outcome=self.outcome,
657665
execution_time=self.plus.get('execution_time'),
658666
execution_wall_clock_time=self.plus.get(

0 commit comments

Comments
 (0)