Skip to content

Commit 6df30c6

Browse files
committed
new submission flow complete
Signed-off-by: Tathagat Thapliyal <tathagat.thapliyal@gmail.com>
1 parent d54f0d9 commit 6df30c6

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"build": "tsc",
4040
"prestart": "npm run build",
4141
"start": "./wait-for-it.sh ${AMQP_HOST}:${AMQP_PORT} -- node dist/taskmaster.js",
42+
"dev": "NODE_PATH=dist nodemon dist/taskmaster.js",
4243
"test": "docker build . -t codingblocks/judge-taskmaster && mocha --timeout 10000 --exit --require ts-node/register test/**/*.ts",
4344
"test.parallel": "mocha-parallel-tests --timeout 10000 --exit --require ts-node/register test/**/*.ts",
4445
"cover": "nyc npm test"

src/taskmaster.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ amqp.connect(`amqp://${config.AMQP.USER}:${config.AMQP.PASS}@${config.AMQP.HOST}
2626
channel.assertQueue(jobQ);
2727
channel.consume(jobQ, async (msg) => {
2828
try {
29-
const payload = JSON.parse(msg.content.toString())
29+
const payload = JSON.parse(msg.content.toString())
30+
3031
let job
3132
if (payload.testcases) {
3233
job = new SubmitJob(payload)
3334
} else {
3435
job = new RunJob(payload)
3536
}
37+
3638
const jobResult = await execute(job)
37-
39+
3840
// TODO
3941
channel.sendToQueue(successQ, (new Buffer(JSON.stringify(jobResult))))
4042
channel.ack(msg)

src/tasks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { RunJob, SubmitJob, Job } from "./job";
1010
export function execute(job: RunJob): Promise<RunResult>
1111
export function execute(job: SubmitJob): Promise<SubmissionResult>
1212
export async function execute (job: Job) {
13-
// Create RUNBOX
13+
// Create RUNBOX
1414
rm('-rf', config.RUNBOX.DIR)
1515
mkdir('-p', config.RUNBOX.DIR)
1616
const currentJobDir = path.join(config.RUNBOX.DIR, job.id.toString())

src/tasks/submission.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class SubmissionScenario implements Scenario {
3333

3434
return Promise.all(job.testcases.map(async testcase => {
3535
const rootDir = path.join(testCasesDir, '' + testcase.id)
36-
mkdir('-p', rootDir)
37-
console.log(rootDir)
36+
mkdir('-p', rootDir)
3837
const input = await download(testcase.input, path.join(rootDir, 'stdin'))
3938
const output = await download(testcase.output, path.join(rootDir, 'stdout'))
4039
}))

0 commit comments

Comments
 (0)