Skip to content

Commit

Permalink
Add batching of testcase updates to protocol; #408
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyene committed Oct 26, 2019
1 parent a916061 commit cb6d376
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
3 changes: 3 additions & 0 deletions dmoj/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def supported_problems_packet(self, problems):
def test_case_status_packet(self, position, result):
pass

def multi_test_case_status_packet(self, updates):
pass

def compile_error_packet(self, log):
pass

Expand Down
25 changes: 16 additions & 9 deletions dmoj/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,22 @@ def test_case_status_packet(self, position: int, result):
result.points, result.total_points)
self._send_packet({'name': 'test-case-status',
'submission-id': self.judge.current_submission_id,
'position': position,
'status': result.result_flag,
'time': result.execution_time,
'points': result.points,
'total-points': result.total_points,
'memory': result.max_memory,
'output': result.output,
'extended-feedback': result.extended_feedback,
'feedback': result.feedback})
'cases': [
{
'position': position,
'status': result.result_flag,
'time': result.execution_time,
'points': result.points,
'total-points': result.total_points,
'memory': result.max_memory,
'output': result.output,
'extended-feedback': result.extended_feedback,
'feedback': result.feedback,
} for position, result in updates
]})

def test_case_status_packet(self, position, result):
self.multi_test_case_status_packet([(position, result)])

def compile_error_packet(self, message: str):
log.info('Compile error: %d', self.judge.current_submission_id)
Expand Down
4 changes: 4 additions & 0 deletions dmoj/testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def test_case_status_packet(self, position, result):
self.fail('Unexpected feedback: "%s", expected: "%s"' %
(result.feedback, '", "'.join(feedback)))

def multi_test_case_status_packet(self, updates):
for position, result in updates:
self.test_case_status_packet(position, result)

def compile_error_packet(self, log):
if 'CE' not in self.codes_all:
self.fail('Unexpected compile error')
Expand Down

0 comments on commit cb6d376

Please sign in to comment.