upgrade to python3;add some validator examples
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env python2.6
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import string
|
||||
from string import split
|
||||
from os import path
|
||||
from Queue import Queue
|
||||
from queue import Queue
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
class EngineConfig:
|
||||
@@ -39,9 +38,10 @@ class EngineConfig:
|
||||
stdin=pa.stdout, stdout=PIPE)
|
||||
output = pb.communicate()[0]
|
||||
if output:
|
||||
for user in string.split(output, '\n'):
|
||||
user = string.strip(user)
|
||||
if user: self.runas.put(user)
|
||||
for user in output.decode().split('\n'):
|
||||
user = user.strip()
|
||||
if user:
|
||||
self.runas.put(user)
|
||||
pa.wait()
|
||||
pb.wait()
|
||||
|
||||
@@ -49,7 +49,7 @@ class EngineConfig:
|
||||
self.languages[profile] = tester
|
||||
|
||||
def get_tester(self, profile):
|
||||
if self.languages.has_key(profile):
|
||||
if profile in self.languages:
|
||||
return self.languages[profile]
|
||||
|
||||
def add_datasource(self, ds):
|
||||
@@ -65,41 +65,37 @@ class EngineConfig:
|
||||
default_compileguard = (
|
||||
'<judgehome>/scripts/compile-guard', ' <datadir>'
|
||||
)
|
||||
default_runguard = split(
|
||||
'/usr/bin/sudo -u <user> <judgehome>/scripts/binary-guard ' +
|
||||
default_runguard = (
|
||||
'/usr/bin/sudo -u <user> <judgehome>/scripts/binary-guard ' +
|
||||
'-e <extraproc> ' +
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x',
|
||||
' '
|
||||
)
|
||||
maxmem_runguard = split(
|
||||
'/usr/bin/sudo -u <user> <judgehome>/scripts/binary-guard ' +
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x'
|
||||
).split(' ')
|
||||
maxmem_runguard = (
|
||||
'/usr/bin/sudo -u <user> <judgehome>/scripts/binary-guard ' +
|
||||
'-e <extraproc> ' +
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x',
|
||||
' '
|
||||
)
|
||||
java_runguard = split(
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x'
|
||||
).split(' ')
|
||||
java_runguard = (
|
||||
'/usr/bin/sudo -u <user> ' +
|
||||
'<judgehome>/scripts/java-guard -t <timelimit> -T 5 -m 262144 ' +
|
||||
'-e <extraproc> ' +
|
||||
'-d <rundir> -o <statfile> -p -x', ' '
|
||||
)
|
||||
python_runguard = split(
|
||||
'-d <rundir> -o <statfile> -p -x'
|
||||
).split(' ')
|
||||
python_runguard = (
|
||||
'<judgehome>/scripts/python-guardd ' +
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x',
|
||||
' '
|
||||
)
|
||||
mono_runguard = split(
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x'
|
||||
).split(' ')
|
||||
mono_runguard = (
|
||||
'/usr/bin/sudo -u <user> ' +
|
||||
'<judgehome>/scripts/mono-guard -t <timelimit> -T 5 -m <maxmem> ' +
|
||||
'-e <extraproc> ' +
|
||||
'-d <rundir> -o <statfile> -p -x', ' '
|
||||
)
|
||||
bash_runguard = split(
|
||||
'-d <rundir> -o <statfile> -p -x'
|
||||
).split(' ')
|
||||
bash_runguard = (
|
||||
'/usr/bin/sudo -u <user> <judgehome>/scripts/bash-guard ' +
|
||||
'-e <extraproc> ' +
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x',
|
||||
' '
|
||||
)
|
||||
'-t <timelimit> -T 5 -m <maxmem> -d <rundir> -o <statfile> -p -x'
|
||||
).split(' ')
|
||||
default_compare = (
|
||||
'<judgehome>/scripts/compare-guard', '<language>', '<codefile>',
|
||||
'<stdinfile>', '<stdoutfile>', '<resultfile>'
|
||||
@@ -151,7 +147,7 @@ class EngineConfig:
|
||||
j2se15 = SimpleTester(
|
||||
source = 'Main.java', target = 'Main.class',
|
||||
compile = ('<judgehome>/scripts/javac-1.5',),
|
||||
run = split('/usr/bin/java -cp <datadir> -Xms8M -Xmx64M Main'),
|
||||
run = ('/usr/bin/java -cp <datadir> -Xms8M -Xmx64M Main').split(),
|
||||
runenv = {},
|
||||
basemem = {'RSS' : 7560 },
|
||||
baseproc = 8,
|
||||
@@ -163,7 +159,7 @@ class EngineConfig:
|
||||
j2se16 = SimpleTester(
|
||||
source = 'Main.java', target = 'Main.class',
|
||||
compile = ('<judgehome>/scripts/javac-1.6',),
|
||||
run = split('/usr/bin/java -cp <datadir> -Xms8M -Xmx64M Main'),
|
||||
run = ('/usr/bin/java -cp <datadir> -Xms8M -Xmx64M Main').split(),
|
||||
runenv = {},
|
||||
basemem = {'RSS' : 7560 },
|
||||
baseproc = 8,
|
||||
|
||||
Reference in New Issue
Block a user