From de8cc9330145f76be7a769d75a333d61cd72b899 Mon Sep 17 00:00:00 2001 From: Mateusz Masiarz Date: Mon, 23 Sep 2024 10:37:21 +0200 Subject: [PATCH 1/5] Change default checker to oicompare (#31) * Change default checker to oicompare * Ability to change oicompare's language * Allow changing oicompare format --- setup.py | 2 +- sio/executors/checker.py | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index bee6a64..dffbf93 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name = "sioworkers", - version = '1.5.2', + version = '1.5.3', author = "SIO2 Project Team", author_email = 'sio2@sio2project.mimuw.edu.pl', description = "Programming contest judging infrastructure", diff --git a/sio/executors/checker.py b/sio/executors/checker.py index 98512ef..8a898ab 100644 --- a/sio/executors/checker.py +++ b/sio/executors/checker.py @@ -87,12 +87,12 @@ def execute_checker(with_stderr=False, stderr=None): return renv['stdout'] -def _run_compare(env): - e = SandboxExecutor('exec-sandbox') +def _run_compare(env, format): + e = SandboxExecutor('oicompare-sandbox-v1.0.2') renv = _run_in_executor( - env, [os.path.join('bin', 'compare'), 'hint', 'out'], e, ignore_errors=True + env, [os.path.join('bin', 'oicompare'), 'hint', 'out', format], e, ignore_errors=True ) - return renv['stdout'] + return renv def _limit_length(s): @@ -116,7 +116,21 @@ def run(environ, use_sandboxes=True): output = _run_checker(environ, use_sandboxes) elif use_sandboxes: - output = _run_compare(environ) + renv = _run_compare(environ, environ.get('checker_format', 'english_abbreviated')) + if renv['return_code'] == 0: + environ['result_code'] = 'OK' + environ['result_percentage'] = (100, 1) + elif renv['return_code'] == 1: + environ['result_code'] = 'WA' + environ['result_percentage'] = (0, 1) + # Should be redundant because we are using oicompare with abbreviated output, + # but just in case. + environ['result_string'] = _limit_length(renv['stdout'][0]) + else: + raise CheckerError( + 'oicompare returned code(%d). Checker renv: %s' % (renv['return_code'], renv) + ) + return environ else: output = _run_diff(environ) except (CheckerError, ExecError) as e: @@ -155,4 +169,4 @@ def output_to_fraction(output_str): except ZeroDivisionError: raise CheckerError('Zero division in checker output "%s"' % output_str) except TypeError: - raise CheckerError('Invalid checker output "%s"' % output_str) \ No newline at end of file + raise CheckerError('Invalid checker output "%s"' % output_str) From e2df801015542493b7b804dd01dd2141a070f58c Mon Sep 17 00:00:00 2001 From: Iteron-dev Date: Mon, 25 Nov 2024 16:25:42 +0100 Subject: [PATCH 2/5] Deps: Update Twisted and sortedcontainers --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index dffbf93..7be0ecf 100644 --- a/setup.py +++ b/setup.py @@ -18,8 +18,8 @@ 'bsddb3==6.2.7', 'simplejson==3.14.0', 'supervisor>=4.0,<4.3', - 'Twisted==20.3.0', - 'sortedcontainers==2.1.0', + 'Twisted==23.8.0', + 'sortedcontainers==2.4.0', 'six', 'urllib3>=1.26.14,<2.0', ], From 6f722f1186f138bfea9b93ec52767563d010033c Mon Sep 17 00:00:00 2001 From: Iteron-dev Date: Mon, 25 Nov 2024 16:51:33 +0100 Subject: [PATCH 3/5] Bump sioworkers version in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7be0ecf..b54ca0e 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name = "sioworkers", - version = '1.5.3', + version = '1.5.4', author = "SIO2 Project Team", author_email = 'sio2@sio2project.mimuw.edu.pl', description = "Programming contest judging infrastructure", From f2b4b432634b46b000cd79cb387ba6f8a5c2461c Mon Sep 17 00:00:00 2001 From: Iteron-dev Date: Mon, 25 Nov 2024 17:12:18 +0100 Subject: [PATCH 4/5] Bump filetracker from 2.1.5 to 2.2.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b54ca0e..a8d4ab4 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ namespace_packages = ['sio', 'sio.compilers', 'sio.executors'], install_requires = [ - 'filetracker>=2.1.5,<3.0', + 'filetracker[server]==2.2.0', 'bsddb3==6.2.7', 'simplejson==3.14.0', 'supervisor>=4.0,<4.3', From 87989e3af8dc1859232f1cb279c53957d2a3ebf3 Mon Sep 17 00:00:00 2001 From: Iteron-dev Date: Mon, 25 Nov 2024 17:21:38 +0100 Subject: [PATCH 5/5] Resolve requested changes --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a8d4ab4..77a1d1e 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ namespace_packages = ['sio', 'sio.compilers', 'sio.executors'], install_requires = [ - 'filetracker[server]==2.2.0', + 'filetracker[server]>=2.2.0,<3.0', 'bsddb3==6.2.7', 'simplejson==3.14.0', 'supervisor>=4.0,<4.3',