Configurations
Exchange

Exchange Configuration

Exchange receives user-submitted judge tasks and hands them over to Composer, then returns the judge reports sent by Composer to the users. To improve flexibility, the judge system allows users to configure multiple Exchanges to work together. Currently, Seele provides two Exchange implementations, offering users various ways to interact with the judge system: HTTP Exchange and AMQP Exchange.

The configuration accepts a dictionary, with keys being strings representing the Exchange's name, and values being one of the two types of Exchange configurations, as described below.

HTTP Exchange

HTTP Exchange starts an HTTP endpoint to listen for user-submitted judge task requests, with the request body being YAML text. Its configuration is shown in the table below:

NameTypeOptionalDescription
type'http'NoIndicates the Exchange type is HTTP Exchange
addressstringYesThe address the HTTP endpoint listens to. Default value is 127.0.0.1
portnumberNoThe port the HTTP endpoint listens to
max_body_size_bytesnumberYesThe maximum size of the received HTTP request body, requests exceeding the limit will be rejected. Unit is Bytes. Default value is 8 MiB

By default, HTTP Exchange only returns completion reports or error reports. Users need to add progress=true to the request's Query params to additionally obtain progress reports. HTTP Exchange separates each judge report JSON data with \n.

AMQP Exchange

AMQP Exchange uses the popular message communication protocol Amqp 0.9.1 (opens in a new tab) in conjunction with message queues like RabbitMQ (opens in a new tab) to obtain judge tasks and output judge reports. Compared to HTTP Exchange, it is a more ideal way to handle large-scale traffic in production environments.

Do not confuse Seele's Exchange concept with the Exchange concept in Amqp protocol.

Its configuration is shown in the table below:

NameTypeDescription
type'amqp'Indicates the Exchange type is AMQP Exchange
urlstringThe Amqp endpoint URL
submissionobjectConfiguration for receiving judge tasks, see below
reportobjectConfiguration for sending judge reports, see below

submission Configuration

Seele listens for submitted judge tasks by creating the corresponding queue and binding it to the exchange using the routing key according to the configuration listed in the table below.

NameTypeDescription
exchangeobjectAmqp exchange configuration, see below
routing_keystringRouting key for judge tasks
queuestringQueue name for listening to exchange messages
queue_optionsobjectOptional. Queue settings for listening to exchange messages. See generated.rs (opens in a new tab)

report Configuration

Seele sends judge reports to the exchange using the corresponding routing key according to the configuration listed in the table below. The sent message body is JSON plain text.

NameTypeDescription
exchangeobjectAmqp exchange configuration, see below
report_routing_keystringRouting key used when sending completion reports or error reports
progress_routing_keystringOptional. Routing key used when sending progress reports. If empty, no progress reports are sent

exchange Configuration

NameTypeDescription
namestringExchange name
kindstringOptional. Amqp exchange type. See exchange.rs (opens in a new tab)
optionsobjectOptional. Settings for declaring Amqp exchange. See generated.rs (opens in a new tab)