Skip to content
Merged

Misc #27

Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion src/routes/api/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const handleSuccessForSubmission = function (result: RunResponse) {
// send a post request to callback
(async () => {
// 1. upload the result to s3 and get the url
const code = result.stderr ? 400 : 200
const {url} = await upload(result)

// 2. save the url in db
Expand All @@ -74,7 +75,7 @@ const handleSuccessForSubmission = function (result: RunResponse) {
})

// make the callback request
await axios.post(job.callback, {id: result.id, outputs: [url]})
await axios.post(job.callback, {id: result.id, code, outputs: [url]})
})()
break;
}
Expand Down Expand Up @@ -138,6 +139,7 @@ const getRunPoolElement = function (body: RunRequestBody, res: Response): RunPoo
* HTTP/1.1 200 OK
* {
* "id": 10,
* "code": 200,
* "outputs": ["http://localhost/judge-submissions/file.json"]
* }
*/
Expand Down
4 changes: 2 additions & 2 deletions src/utils/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import config = require('../../config')

const client = new Minio.Client({
endPoint: config.S3.endpoint,
port: config.S3.port,
useSSL: config.S3.ssl,
port: +config.S3.port,
useSSL: !!config.S3.ssl,
accessKey: config.S3.accessKey,
secretKey: config.S3.secretKey,
})
Expand Down