Skip to content

Commit b1d68b7

Browse files
committed
change formatting of CPU time when getting TLE
emphasizes that time limit exceeded means the submission was terminated early. by default this would show the time as "10.035 sec" or similar, which has misled people in the past.
1 parent e5f28c4 commit b1d68b7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cms/grading/scoretypes/abc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
from cms import FEEDBACK_LEVEL_RESTRICTED
3838
from cms.db import SubmissionResult
39+
from cms.grading.steps import EVALUATION_MESSAGES
3940
from cms.locale import Translation, DEFAULT_TRANSLATION
4041
from cms.server.jinja2_toolbox import GLOBAL_ENVIRONMENT
4142
from jinja2 import Template
@@ -295,7 +296,9 @@ class ScoreTypeGroup(ScoreTypeAlone):
295296
</td>
296297
{% if feedback_level == FEEDBACK_LEVEL_FULL %}
297298
<td class="execution-time">
298-
{% if "time" in tc and tc["time"] is not none %}
299+
{% if "time_limit_was_exceeded" in tc and tc["time_limit_was_exceeded"] %}
300+
&gt; {{ tc["time_limit"]|format_duration }}
301+
{% elif "time" in tc and tc["time"] is not none %}
299302
{{ tc["time"]|format_duration }}
300303
{% else %}
301304
{% trans %}N/A{% endtrans %}
@@ -430,11 +433,17 @@ def compute_score(self, submission_result):
430433
tc_outcome = self.get_public_outcome(
431434
tc_score, parameter)
432435

436+
time_limit_was_exceeded = False
437+
if evaluations[tc_idx].text == [EVALUATION_MESSAGES.get("timeout").message]:
438+
time_limit_was_exceeded = True
439+
433440
testcases.append({
434441
"idx": tc_idx,
435442
"outcome": tc_outcome,
436443
"text": evaluations[tc_idx].text,
437444
"time": evaluations[tc_idx].execution_time,
445+
"time_limit": evaluations[tc_idx].dataset.time_limit,
446+
"time_limit_was_exceeded": time_limit_was_exceeded,
438447
"memory": evaluations[tc_idx].execution_memory,
439448
"show_in_restricted_feedback": self.public_testcases[tc_idx],
440449
"show_in_oi_restricted_feedback": self.public_testcases[tc_idx]})

0 commit comments

Comments
 (0)