488 lines
15 KiB
YAML
488 lines
15 KiB
YAML
RunnerHealthResponse:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- status
|
|
properties:
|
|
status:
|
|
type: string
|
|
enum:
|
|
- ok
|
|
RunnerReadinessResponse:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- status
|
|
properties:
|
|
status:
|
|
type: string
|
|
enum:
|
|
- ready
|
|
- not_ready
|
|
Problem:
|
|
type: object
|
|
description: Problem details (RFC 9457) returned with the application/problem+json media type for every error response. This is the runner copy of the public api/core Problem schema; keep both copies identical except for descriptions and the ProblemCode enum. `code` is the stable, machine-readable reason; clients branch on it rather than on `title`, `detail`, or the HTTP status alone. The body never contains internal error text, stack traces, SQL, file paths, credentials, contact data, or echoed request values.
|
|
additionalProperties: false
|
|
required:
|
|
- type
|
|
- title
|
|
- status
|
|
- code
|
|
properties:
|
|
type:
|
|
type: string
|
|
format: uri-reference
|
|
maxLength: 256
|
|
description: URI that identifies the problem type. It has the form `urn:lincodex:problem:<code>` and is an identifier, not a link to dereference.
|
|
title:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 200
|
|
description: Short, fixed English summary of the problem type. It does not change between occurrences.
|
|
status:
|
|
type: integer
|
|
format: int32
|
|
minimum: 400
|
|
maximum: 599
|
|
description: HTTP status code generated by the origin server.
|
|
code:
|
|
$ref: '#/ProblemCode'
|
|
detail:
|
|
type: string
|
|
maxLength: 1000
|
|
description: Safe English explanation of this occurrence. It never contains internal error text or request values.
|
|
instance:
|
|
type: string
|
|
format: uri-reference
|
|
maxLength: 2048
|
|
description: URI reference that identifies this occurrence, when one exists.
|
|
trace_id:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 128
|
|
pattern: ^[A-Za-z0-9._-]+$
|
|
description: Request identifier of the call when the caller propagated one; it is not a secret.
|
|
errors:
|
|
type: array
|
|
maxItems: 100
|
|
description: Field-level reasons for validation_failed. Other codes omit it.
|
|
items:
|
|
$ref: '#/ProblemFieldError'
|
|
ProblemCode:
|
|
type: string
|
|
description: 'Stable error code of the runner API. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.
|
|
|
|
|
|
- validation_failed (400): parameters or body do not match the contract or a semantic rule of SubmitRun; `errors` points at the fields.
|
|
|
|
- unauthenticated (401): the bearer token is missing or wrong.
|
|
|
|
- not_found (404): the route or the run does not exist.
|
|
|
|
- method_not_allowed (405): the route does not support the method.
|
|
|
|
- payload_too_large (413): the request body exceeds the limit.
|
|
|
|
- unsupported_media_type (415): the request Content-Type is not accepted.
|
|
|
|
- idempotency_key_reused (422): the run ID was already used with a different payload.
|
|
|
|
- internal (500): unexpected server error.
|
|
|
|
- runner_busy (503): every sandbox slot is busy or the runner is draining; see Retry-After.
|
|
|
|
|
|
The Problem shape is the api/core shape; only this enum is specific to the runner.'
|
|
enum:
|
|
- validation_failed
|
|
- unauthenticated
|
|
- not_found
|
|
- method_not_allowed
|
|
- payload_too_large
|
|
- unsupported_media_type
|
|
- idempotency_key_reused
|
|
- internal
|
|
- runner_busy
|
|
ProblemFieldError:
|
|
type: object
|
|
description: One reason why a request field or parameter is invalid.
|
|
additionalProperties: false
|
|
required:
|
|
- in
|
|
- pointer
|
|
- code
|
|
- message
|
|
properties:
|
|
in:
|
|
$ref: '#/ProblemFieldLocation'
|
|
pointer:
|
|
type: string
|
|
maxLength: 1024
|
|
pattern: ^(/([^~/]|~[01])*)*$
|
|
description: JSON Pointer (RFC 6901). For `body` it points into the request body document, for example `/limits/time_limit_ms`; an empty string means the whole body. For a parameter it is `/` followed by the parameter name, for example `/run_id`.
|
|
code:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 64
|
|
pattern: ^[a-z][a-z0-9_]*$
|
|
description: Stable field reason. Current values are `required` (missing value) and `invalid` (malformed value or a value outside the schema). Clients must tolerate new values.
|
|
message:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 500
|
|
description: Fixed English message that never echoes the submitted value.
|
|
ProblemFieldLocation:
|
|
type: string
|
|
description: Part of the request that contains the invalid field.
|
|
enum:
|
|
- body
|
|
- query
|
|
- path
|
|
- header
|
|
- cookie
|
|
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: '#/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: '#/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: '#/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: '#/TestKey'
|
|
visibility:
|
|
$ref: '#/TestVisibility'
|
|
checker:
|
|
$ref: '#/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: '#/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: '#/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: '#/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: '#/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: '#/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: '#/RunState'
|
|
result:
|
|
$ref: '#/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: '#/RunOutcome'
|
|
compile:
|
|
$ref: '#/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: '#/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: '#/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: '#/TestKey'
|
|
visibility:
|
|
$ref: '#/TestVisibility'
|
|
outcome:
|
|
$ref: '#/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: '#/TestResult'
|
|
TestResult:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- outcome
|
|
- time_ms
|
|
- wall_time_ms
|
|
- memory_kb
|
|
properties:
|
|
id:
|
|
$ref: '#/TestKey'
|
|
outcome:
|
|
$ref: '#/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: '#/TerminationLimit'
|
|
diagnostic:
|
|
type: string
|
|
maxLength: 2048
|
|
description: Truncated standard error of a failed public test. Hidden tests never carry it.
|