395 lines
12 KiB
YAML
395 lines
12 KiB
YAML
schemas:
|
|
RunRequest:
|
|
type: object
|
|
description: >-
|
|
One source and its test groups. The request has no field for a
|
|
candidate, account, attempt, task, or company; the backend maps a run ID
|
|
to its own records.
|
|
additionalProperties: false
|
|
required:
|
|
- language
|
|
- source
|
|
- limits
|
|
- groups
|
|
properties:
|
|
language:
|
|
$ref: "#/schemas/RunLanguage"
|
|
source:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 65536
|
|
description: >-
|
|
Complete program text in UTF-8. The runner writes it to a read-only
|
|
file inside the sandbox and never logs it.
|
|
limits:
|
|
$ref: "#/schemas/RunLimits"
|
|
groups:
|
|
type: array
|
|
minItems: 1
|
|
maxItems: 4
|
|
description: >-
|
|
Test groups in evaluation order, for example one public group and
|
|
three hidden groups. Group IDs are unique in a run.
|
|
items:
|
|
$ref: "#/schemas/TestGroup"
|
|
RunLanguage:
|
|
type: string
|
|
description: >-
|
|
Language and runtime of the source. `python3` runs the Python 3
|
|
interpreter of the runner image with isolated mode and no bytecode
|
|
writes; a syntax check runs first and fails with compile_error. `go`
|
|
compiles one `package main` file with the Go toolchain of the runner
|
|
image against a prebuilt standard library (no modules, no cgo, no
|
|
network) in a separate compile phase with its own limits; a compile
|
|
or link error is compile_error and no test runs.
|
|
enum:
|
|
- python3
|
|
- go
|
|
RunLimits:
|
|
type: object
|
|
description: Limits applied to every test of the run.
|
|
additionalProperties: false
|
|
required:
|
|
- time_limit_ms
|
|
- memory_limit_mb
|
|
- output_limit_kb
|
|
properties:
|
|
time_limit_ms:
|
|
type: integer
|
|
format: int32
|
|
minimum: 100
|
|
maximum: 10000
|
|
description: >-
|
|
CPU time per test, including interpreter startup, summed over every
|
|
process of the test. The wall-clock limit is twice this value plus
|
|
a fixed startup allowance.
|
|
memory_limit_mb:
|
|
type: integer
|
|
format: int32
|
|
minimum: 32
|
|
maximum: 512
|
|
description: >-
|
|
Memory of the test's processes in MiB, enforced by a cgroup v2
|
|
memory limit without swap. The limit also leaves a small fixed
|
|
allowance for the sandbox supervisor process.
|
|
output_limit_kb:
|
|
type: integer
|
|
format: int32
|
|
minimum: 1
|
|
maximum: 1024
|
|
description: >-
|
|
Standard output per test in KiB. The test is stopped as soon as it
|
|
writes more.
|
|
TestGroup:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- visibility
|
|
- checker
|
|
- tests
|
|
properties:
|
|
id:
|
|
$ref: "#/schemas/TestKey"
|
|
visibility:
|
|
$ref: "#/schemas/TestVisibility"
|
|
checker:
|
|
$ref: "#/schemas/Checker"
|
|
tests:
|
|
type: array
|
|
minItems: 1
|
|
maxItems: 50
|
|
description: >-
|
|
Tests in evaluation order. Test IDs are unique in a group. A group
|
|
stops at its first failed test.
|
|
items:
|
|
$ref: "#/schemas/TestCase"
|
|
TestKey:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 32
|
|
pattern: "^[a-z0-9][a-z0-9_-]{0,31}$"
|
|
description: >-
|
|
Opaque label chosen by the backend, for example `public` or `hidden-1`.
|
|
It is not a database identifier.
|
|
TestVisibility:
|
|
type: string
|
|
description: >-
|
|
`public` tests may be shown to the person who wrote the source; their
|
|
results may carry a diagnostic excerpt. `hidden` results never carry
|
|
program output or diagnostics.
|
|
enum:
|
|
- public
|
|
- hidden
|
|
Checker:
|
|
type: object
|
|
description: >-
|
|
How the standard output of a test is compared with `expected_output`.
|
|
`numbers` requires `abs_tolerance`, `rel_tolerance`, or both; `custom`
|
|
requires `program`. Other kinds take no parameter. New kinds add a
|
|
`kind` value and their own optional parameters.
|
|
additionalProperties: false
|
|
required:
|
|
- kind
|
|
properties:
|
|
kind:
|
|
$ref: "#/schemas/CheckerKind"
|
|
abs_tolerance:
|
|
type: number
|
|
format: double
|
|
minimum: 0
|
|
maximum: 1000000000
|
|
description: Largest accepted absolute difference of two numeric tokens.
|
|
rel_tolerance:
|
|
type: number
|
|
format: double
|
|
minimum: 0
|
|
maximum: 1
|
|
description: >-
|
|
Largest accepted difference of two numeric tokens relative to the
|
|
expected value.
|
|
program:
|
|
$ref: "#/schemas/CheckerProgram"
|
|
CheckerProgram:
|
|
type: object
|
|
description: >-
|
|
Checker program of the task family. It runs in the sandbox with the
|
|
same isolation as the solution and fixed limits of its own (5 s CPU,
|
|
256 MiB). Its arguments are the paths of three read-only files: the
|
|
test input, the expected output, and the actual output. Exit status 0
|
|
accepts, 1 rejects, and anything else, a signal, or a limit is a
|
|
checker failure, which makes the run infrastructure_failure. Its own
|
|
output is discarded and never returned.
|
|
additionalProperties: false
|
|
required:
|
|
- language
|
|
- source
|
|
properties:
|
|
language:
|
|
$ref: "#/schemas/RunLanguage"
|
|
source:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 65536
|
|
CheckerKind:
|
|
type: string
|
|
description: |-
|
|
- exact: both texts are equal after replacing CRLF with LF, removing trailing spaces and tabs at the end of each line, and removing trailing empty lines.
|
|
- tokens: both texts split on ASCII whitespace give the same sequence of tokens.
|
|
- numbers: like tokens, but two finite numeric tokens are equal when their difference is within abs_tolerance or within rel_tolerance times the expected value; other tokens must be equal.
|
|
- custom: the checker program of the task family decides in the sandbox.
|
|
enum:
|
|
- exact
|
|
- tokens
|
|
- numbers
|
|
- custom
|
|
TestCase:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- input
|
|
- expected_output
|
|
properties:
|
|
id:
|
|
$ref: "#/schemas/TestKey"
|
|
input:
|
|
type: string
|
|
maxLength: 262144
|
|
description: UTF-8 text written to the standard input of the program.
|
|
expected_output:
|
|
type: string
|
|
maxLength: 262144
|
|
description: UTF-8 text the checker compares with the standard output.
|
|
RunState:
|
|
type: string
|
|
description: >-
|
|
`running` until every group was evaluated or the run failed;
|
|
`finished` when `result` is final.
|
|
enum:
|
|
- running
|
|
- finished
|
|
RunStatus:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- run_id
|
|
- state
|
|
properties:
|
|
run_id:
|
|
type: string
|
|
format: uuid
|
|
state:
|
|
$ref: "#/schemas/RunState"
|
|
result:
|
|
$ref: "#/schemas/RunResult"
|
|
RunOutcome:
|
|
type: string
|
|
description: |-
|
|
Outcome of a test, a group, a compile step, or a whole run.
|
|
|
|
- accepted: the program exited with status 0 within every limit and the checker accepted the output.
|
|
- wrong_answer: the program exited with status 0 within every limit, but the checker rejected the output.
|
|
- compile_error: the source was rejected before any test ran (for Python, a syntax error).
|
|
- time_limit_exceeded: the CPU time limit or the wall-clock limit stopped the program.
|
|
- memory_limit_exceeded: the cgroup memory limit stopped the program.
|
|
- output_limit_exceeded: the program wrote more standard output than the limit.
|
|
- runtime_error: the program exited with a non-zero status, was killed by a signal, or reached the process limit.
|
|
- infrastructure_failure: the runner could not evaluate the source; the outcome says nothing about the program, and the caller may retry with a new run ID.
|
|
|
|
A run's outcome is compile_error or infrastructure_failure when that happened, otherwise the outcome of the first failed test in request order, otherwise accepted. A group's outcome is the outcome of its first failed test, otherwise accepted.
|
|
enum:
|
|
- accepted
|
|
- wrong_answer
|
|
- compile_error
|
|
- time_limit_exceeded
|
|
- memory_limit_exceeded
|
|
- output_limit_exceeded
|
|
- runtime_error
|
|
- infrastructure_failure
|
|
TerminationLimit:
|
|
type: string
|
|
description: >-
|
|
The limit that stopped a test: CPU time, wall-clock time, memory,
|
|
standard output, or the number of processes and threads.
|
|
enum:
|
|
- cpu_time
|
|
- wall_time
|
|
- memory
|
|
- output
|
|
- processes
|
|
RunResult:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- outcome
|
|
- groups
|
|
- duration_ms
|
|
properties:
|
|
outcome:
|
|
$ref: "#/schemas/RunOutcome"
|
|
compile:
|
|
$ref: "#/schemas/CompileResult"
|
|
groups:
|
|
type: array
|
|
maxItems: 4
|
|
description: >-
|
|
One result per requested group in request order. After
|
|
compile_error or infrastructure_failure every group has that
|
|
outcome and no tests.
|
|
items:
|
|
$ref: "#/schemas/GroupResult"
|
|
duration_ms:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
description: Wall-clock time of the whole run in the runner.
|
|
CompileResult:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- outcome
|
|
properties:
|
|
outcome:
|
|
$ref: "#/schemas/RunOutcome"
|
|
diagnostic:
|
|
type: string
|
|
maxLength: 4096
|
|
description: >-
|
|
Compiler or syntax checker message for compile_error, truncated to
|
|
the limit. It can quote the source, never test data.
|
|
GroupResult:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- visibility
|
|
- outcome
|
|
- passed_tests
|
|
- total_tests
|
|
- tests
|
|
properties:
|
|
id:
|
|
$ref: "#/schemas/TestKey"
|
|
visibility:
|
|
$ref: "#/schemas/TestVisibility"
|
|
outcome:
|
|
$ref: "#/schemas/RunOutcome"
|
|
passed_tests:
|
|
type: integer
|
|
format: int32
|
|
minimum: 0
|
|
maximum: 50
|
|
total_tests:
|
|
type: integer
|
|
format: int32
|
|
minimum: 0
|
|
maximum: 50
|
|
max_time_ms:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
description: Largest CPU time of an evaluated test of the group.
|
|
max_memory_kb:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
description: Largest peak memory of an evaluated test of the group.
|
|
tests:
|
|
type: array
|
|
maxItems: 50
|
|
description: >-
|
|
Results of the evaluated tests in order. Tests after the first
|
|
failed one are not run and not listed.
|
|
items:
|
|
$ref: "#/schemas/TestResult"
|
|
TestResult:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- outcome
|
|
- time_ms
|
|
- wall_time_ms
|
|
- memory_kb
|
|
properties:
|
|
id:
|
|
$ref: "#/schemas/TestKey"
|
|
outcome:
|
|
$ref: "#/schemas/RunOutcome"
|
|
time_ms:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
description: CPU time of every process of the test.
|
|
wall_time_ms:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
memory_kb:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
description: >-
|
|
Peak memory of the test in KiB: the cgroup high-water mark of every
|
|
process of the test, including the sandbox supervisor process and
|
|
file cache charged to the test.
|
|
exit_code:
|
|
type: integer
|
|
format: int32
|
|
description: Exit status when the program exited normally.
|
|
signal:
|
|
type: integer
|
|
format: int32
|
|
minimum: 1
|
|
maximum: 64
|
|
description: Signal number when the program was killed by a signal.
|
|
limit:
|
|
$ref: "#/schemas/TerminationLimit"
|
|
diagnostic:
|
|
type: string
|
|
maxLength: 2048
|
|
description: >-
|
|
Truncated standard error of a failed public test. Hidden tests
|
|
never carry it.
|