Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control ↔ exec の API を追加 #195

Merged
merged 7 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions api/judge/control/to_exec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
openapi: "3.0.3"
info:
title: control to exec API
version: "0.1"
license:
name: MIT
url: "https://github.com/traP-jp/traO-Judge-docs/blob/main/LICENSE"
servers:
- url: https://api.server.test/v1
paths:
"/result":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/executeのresponseとして返した方が楽かも mustではないけど

post:
operationId: result
description: ジャッジの実行を終了した exec container から judge result message を受け取る.
tags:
- judge
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/JudgeResultMessage"
required: true
summary: ジャッジ結果
responses:
"200":
description: OK
"400":
description: Bad Request
security:
- bearerAuth: []
"/container":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これはawsがやってくれるという話になっていたはずだからzoiくんに確認をとってほしいです

post:
operationId: container
description: 新たに起動した exec container から container created message を受け取る.
tags:
- infra
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ContainerCreatedMessage"
required: true
summary: コンテナ
responses:
"200":
description: OK
"400":
description: Bad Request
security:
- bearerAuth: []
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
File:
title: File
type: object
description: ファイル
properties:
fileId:
title: fileId
type: string
description: ファイルの UUID
format: uuid
example: 01234567-89ab-cdef-0123-456789abcdef
filePath:
title: filePath
type: string
description: ファイルのパス
example: "/path/to/file"
required:
- fileId
- filePath
ContainerCreatedMessage:
title: ContainerCreatedMessage
type: object
description: 新たに起動したコンテナから受け取るメッセージ
properties:
containerId:
title: containerId
type: string
description: コンテナの UUID
format: uuid
example: 01234567-89ab-cdef-0123-456789abcdef
containerUrl:
title: containerUrl
type: string
description: |-
コンテナの URL
これを用いて exec container の API を叩く
example: 01234567-89ab-cdef-0123-456789abcdef.default.svc.cluster.local
required:
- containerId
- containerUrl
JudgeResultMessage:
title: JudgeResultMessage
type: object
description: ジャッジの実行を終了したコンテナから受け取るメッセージ
properties:
exitCode:
title: exitCode
type: integer
description: 終了コード
example: 0
stdout:
$ref: "#/components/schemas/File"
stderr:
$ref: "#/components/schemas/File"
readonlyFiles:
title: readonlyFiles
type: array
description: ジャッジに使用したファイル(読み取り専用)
items:
$ref: "#/components/schemas/File"
required:
- exitCode
- stdout
- stderr
- readonlyFiles
106 changes: 106 additions & 0 deletions api/judge/exec/to_control.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
openapi: "3.0.3"
info:
title: exec to control API
version: "0.1"
license:
name: MIT
url: "https://github.com/traP-jp/traO-Judge-docs/blob/main/LICENSE"
servers:
- url: https://api.server.test/v1
paths:
"/execute":
post:
operationId: execute
description: control container から file placed message を受け取り,ジャッジの実行を開始する.
tags:
- judge
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/FilePlacedMessage"
required: true
summary: ジャッジの実行を開始
responses:
"202":
description: |-
Accepted
ジャッジの実行が開始されました.
"400":
description: Bad Request
security:
- bearerAuth: []
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
File:
title: File
type: object
description: ファイル
properties:
fileId:
title: fileId
type: string
description: ファイルの UUID
format: uuid
example: 01234567-89ab-cdef-0123-456789abcdef
filePath:
title: filePath
type: string
description: ファイルのパス
example: "/path/to/file"
required:
- fileId
- filePath
FilePlacedMessage:
title: FilePlacedMessage
type: object
description: ジャッジの実行を開始するトリガーとなるメッセージ
properties:
cmd:
title: cmd
type: string
description: コマンド
example: cmd
envs:
title: envs
type: object
description: 環境たち
additionalProperties:
title: env
type: string
description: 環境
example: env
connectionTimeLimit:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connection/execution time limitはjudge-control app側設定なので、代わりにback-judgeで定義されているoptional info(tl, ml, langみたいなやつ)を渡してほしいです

title: connectionTimeLimit
type: integer
description: 接続時間制限
example: 20000
executionTimeLimit:
title: executionTimeLimit
type: integer
description: 実行時間制限
example: 2000
readonlyFiles:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

説明不足でごめん: ファイルパスは環境変数として渡すからenvsがあるなら消してしまってもいいかも

title: readonlyFiles
type: array
description: ジャッジに使用するファイル(読み取り専用)
items:
$ref: "#/components/schemas/File"
writableFiles:
title: writableFiles
type: array
description: ジャッジに使用するファイル(書き込み可能)
items:
$ref: "#/components/schemas/File"
required:
- cmd
- envs
- connectionTimeLimit
- executionTimeLimit
- readonlyFiles
- writableFiles
Loading