Skip to main content

Job request

Format​

The host converts the HTTP request (or the CLI call) into a job and sends it to the guest as a vsock frame (4 big-endian bytes of length + JSON).

{
"trace_id": "tr-123",
"lang": "python",
"code": "",
"files": [
{"name": "main.py", "content": "import util\nprint(util.dobro(int(input())))"},
{"name": "util.py", "content": "def dobro(x):\n return 2 * x\n"}
],
"stdin": "21",
"timeout": 10
}

Fields​

FieldTypeDescription
trace_idstringjob identifier, returned in the result
langstringlanguage; it must exist in the guest executor
codestringcode of the main file when there are no files
fileslist of {name, content}the job's files; the first one is the main file
stdinstringstandard input; omitted when empty
timeoutintegerseconds
streambooleanasks for the output in chunks before the result; see Streaming
opstringoperation; empty means the code job. The machine operations (exec, put, pty...) are in vsock protocol

Main file​

  • With files, each file is written by name to a temporary directory under /tmp, and the first one is executed (or compiled).
  • With only code, the guest writes script.<ext> — except Java, which becomes Main.java, because the executed class is Main.

Rules applied before the job reaches the guest​

The domain, on the host, rejects the job (HTTP 400 in the API) when:

RuleLimit
languagein the catalog and with an image built on this host (otherwise E006)
stdin≤ 1,000,000 bytes (otherwise E005)
timeout> 0 and ≤ 300 s; missing becomes 10 s
contentcode or at least one file
filesup to 32, no repeated names
total sizesum of code and contents ≤ 4 MiB
file nameno /, no .., not starting with ., ≤ 255 bytes

The name rules prevent writes outside the job directory inside the guest, even though the VM is disposable.

Readiness​

Before the first real job, the host repeatedly sends the VM an sh true job (every 1 ms) until it gets a response. That is how it knows the guest is already listening.