-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_judger.py
60 lines (57 loc) · 1.54 KB
/
test_judger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from judger.judger import Judger
import asyncio
import sys
logicArgs = {
"hostname": "qwq",
"chroot": "/opt/sandbox/rootfs",
"mounts": [
{
"src": "/opt/sandbox-test/working",
"dst": "/sandbox/working",
"limit": 1,
}
],
"executable": "/usr/bin/python3",
"parameters": ["/usr/bin/python3", "logic_python.py"],
"environments": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"time": 20*1000,
"mountProc": True,
"redirectBeforeChroot": True,
"memory": 104857600,
"process": 10,
"user": "nobody",
"workingDirectory": "/sandbox/working",
}
aiArgs = {
"hostname": "qwq",
"chroot": "/opt/sandbox/rootfs",
"mounts": [
{
"src": "/opt/sandbox-test/working",
"dst": "/sandbox/working",
"limit": 0,
}
],
"executable": "/usr/bin/python3",
"parameters": ["/usr/bin/python3", "ai_1.py"],
"environments": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"time": 20*1000,
"mountProc": True,
"redirectBeforeChroot": True,
"memory": 104857600,
"process": 10,
"user": "nobody",
"workingDirectory": "/sandbox/working",
}
async def main():
judger = Judger()
judger.addLocalPlayer(0, aiArgs)
judger.addLocalPlayer(1, aiArgs)
returnCode = await judger.startJudge(logicArgs, "", 'replay', (int)(sys.argv[1]))
print(returnCode)
if __name__ == '__main__':
asyncio.run(main(), debug=True)