Field | Type | Comment |
---|---|---|
id | string | mongo generated |
username | string | unique, indexed |
password | string | bcrypt encrypted |
type | int |
User types:
Type | Code |
---|---|
ROOT | 0 |
ADMIN | 100 |
USER | 200 |
WORKER | 300 |
Field | Type | Comment |
---|---|---|
id | string | mongo generated |
name | string | unique, indexed |
time | int | time limit |
memory | int | memory limit |
cpu | int | cpu limit |
data | string | input data |
Field | Type | Comment |
---|---|---|
id | string | mongo generated |
user | User | reference, indexed |
dataset | Dataset | reference, indexed |
archive | binary | original zip |
status | int | |
submitTime | date | |
judgeTime | date | |
judgeWorker | User | |
timedout | bool | |
stdout | string | |
outOverflow | bool | stdout exceeds limit |
stderr | string | |
errOverflow | bool | stderr exceeds limit |
time | double | running time including docker overhead |
exitcode | int | |
path | string | carp result |
valid | bool | is result valid |
cost | int | path cost |
reason | string | invalid reason |
Status codes:
Status | Code | Comment |
---|---|---|
WAITING | 0 | |
QUEUED | 1 | sent to worker |
RUNNING | 2 | |
FINISHED | 3 |
- All exceptions will result in non-200 status code with body of json format containing further details. A typical response looks like:
{
"timestamp": "2018-10-29T04:46:26.091+0000",
"status": 403,
"error": "Forbidden",
"message": "Not logged in!",
"path": "/api/judge/all"
}
- All responses with 200 status DO NOT include information like the example above.
POST /api/admin/dataset/add
Request body:
{
"name" : "small-1",
"time" : 10,
"memory" : 256,
"cpu" : 1,
"data" : "NAME : small-1\nVERTICES : 12..."
}
Allowed user types: ROOT, ADMIN
Response:
{
"id": "Object id of the added dataset"
}
GET /api/admin/judge/query?user={USER_NAME}&dataset={DATASET_NAME}
Allowed user types: ROOT, ADMIN
Response:
[
{
"id": "5bea74b2e47f881914f10123",
"status": 0,
"submitTime": "2018-11-13T06:52:34.028+0000",
"judgeTime": null,
"timedout": false,
"outOverflow": false,
"errOverflow": false,
"time": 0,
"exitcode": 0,
"valid": false,
"cost": 0,
"reason": null,
"userId": "5be908eea6d72a185426a6ca",
"datasetId": "5be908ffa6d72a185426a781",
"workerName": null
}
]
GET /api/admin/judge/archive?cid={CASE_ID}
Allowed user types: ROOT, ADMIN
Response:
zip archive
GET /api/admin/judge/output?cid={CASE_ID}
Allowed user types: ROOT, ADMIN
Response:
{
"exitcode": 0,
"stdout": "...",
"stderr": "..."
}
POST /api/admin/judge/rejudge
Request body:
{
"cid" : "xxx"
}
Allowed user types: ROOT, ADMIN
Response:
ok
POST /api/admin/user/add
Request body:
{
"username": "user",
"password": "pass",
"type": 300
}
Allowed user types:
- ROOT: ADMIN, WORKER, USER
- ADMIN: USER
Response:
{
"id": "Object id of the added user"
}
POST /api/admin/user/change/password
Request body:
{
"username": "user",
"password": "pass"
}
Allowed user types:
- ROOT: ADMIN, WORKER, USER
- ADMIN: USER
Response:
done
GET /api/dataset/all
Allowed user types: ROOT, ADMIN, USER
Response:
{
"datasets": [
{
"id": "5bd5fb0a044caa567486134d",
"name": "gdb10",
"time": 10,
"memory": 256,
"cpu": 1
}
]
}
GET /api/judge/get?page={PAGE}&size={SIZE}
Allowed user types: ROOT, ADMIN, USER
Response:
{
"baseCases": [
{
"id": "5bdacbaea6d72a1b48b63784",
"status": 3,
"submitTime": "2018-11-01T09:47:26.263+0000",
"judgeTime": "2018-11-01T09:47:25.511+0000",
"timedout": false,
"outOverflow": false,
"errOverflow": false,
"time": 12.249048709869385,
"exitcode": 0,
"valid": true,
"cost": 0,
"reason": null,
"datasetId": "5bd7ddbca6d72a2e908da716",
"userId": "5bd7d6d6a6d72a2e908da712",
"workerName": "judge"
}
],
"total": 1
}
Page start from 0. Ordered by submitTime desc.
GET /api/judge/query?cid={CASE_ID}
Allowed user types: ROOT, ADMIN, USER
Response:
{
"id": "5bd5fbce044caa567486134e",
"status": 3,
"submitTime": "2018-10-28T18:11:26.103+0000",
"judgeTime": "2018-10-28T18:11:36.646+0000",
"timedout": false,
"outOverflow": false,
"errOverflow": false,
"time": 10.630940437316895,
"exitcode": 0,
"valid": false,
"cost": 0,
"reason": null,
"datasetId": "5bd5fb0a044caa567486134d",
"userId": "5bd5fb02044caa5674861349",
"workerName": "judge"
}
GET /api/judge/top?dataset={DATASET_ID}
Allowed user types: ROOT, ADMIN, USER
Response:
{
"baseCases": [
{
"userName": "root",
"datasetId": "5bd602c4044caa5464b356e0",
"submitTime": "2018-10-28T18:41:08.775+0000",
"time": 9.969951629638672,
"cost": 0
}
]
}
Each user appears only once, order by cost asc, time asc, submitTime asc.
GET /api/judge/best?dataset={DATASET_ID}
Allowed user types: ROOT, ADMIN, USER
Response:
{
"baseCases": [
{
"userName": "root",
"datasetId": "5bd602c4044caa5464b356e0",
"submitTime": "2018-10-28T18:41:08.775+0000",
"time": 9.969951629638672,
"cost": 0
}
]
}
GET /api/judge/remain
Allowed user types: ROOT, ADMIN, USER
Response:
{
"remain": 6,
"total": 10
}
Get /api/judge/queue
Allowed user types: ROOT, ADMIN, USER
Response:
{
"length": 2
}
POST /api/judge/submit
Request body:
{
"dataset": "5bd5fb0a044caa567486134d",
"data": "Base64 encoded zip"
}
Allowed user types: ROOT, ADMIN, USER
Response:
{
"cid": "5bd6a0170a44aa105c5927e9",
"remain": 6
}
POST /api/login
Request body:
{
"username": "user",
"password": "123"
}
Response:
{
"uid": "5bd5fb0a044caa567486134c",
"type": 200
}
Logout before login again.
POST /api/logout
Response:
{
"uid": "5bd5fb0a044caa567486134c"
}
GET /api/user/info
Allowed user types: ROOT, ADMIN, WORKER, USER
Response:
{
"uid": "5bd5fb0a044caa567486134c",
"username": "user",
"type": 200
}
POST /api/user/change/password
Request body:
{
"old": "111",
"new": "123"
}
Allowed user types: ROOT, ADMIN, WORKER, USER
Response:
{
"uid": "5bd6ffd10a44aa129c547ff5"
}
Status of 200 means success. Otherwise exception is thrown.