Skip to content

Commit

Permalink
Merge branch 'master' into interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
MasloMaslane authored Nov 26, 2024
2 parents 5a5e252 + c508adb commit f9dcae3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
namespace_packages = ['sio', 'sio.compilers', 'sio.executors'],

install_requires = [
'filetracker>=2.1.5,<3.0',
'filetracker[server]>=2.2.0,<3.0',
'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',
],
Expand Down
26 changes: 20 additions & 6 deletions sio/executors/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down Expand Up @@ -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)
raise CheckerError('Invalid checker output "%s"' % output_str)

0 comments on commit f9dcae3

Please sign in to comment.