Skip to content

Commit 91174fb

Browse files
committed
improve project run
1 parent 8457357 commit 91174fb

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/tasks/scenarios/project.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ export default class ProjectScenario extends Scenario {
2525

2626
run(currentJobDir: string, job: ProjectJob) {
2727

28-
// LANG_CONFIG is undefined rn
28+
// LANG_CONFIG is undefined rn, hence card coding the value of cpus and memory
2929
const LANG_CONFIG = config.LANGS[job.lang]
3030
return exec(`docker run \\
3131
--cpus="1" \\
3232
--memory="100m" \\
3333
--rm \\
3434
-v "${currentJobDir}":/usr/src/runbox \\
3535
-w /usr/src/runbox codingblocks/project-worker-"${job.lang}" \\
36-
/bin/judge.sh -s "${job.submissionDirs}
36+
/bin/judge.sh -s "${job.submissionDirs}"
3737
`);
3838
}
3939

@@ -53,28 +53,27 @@ export default class ProjectScenario extends Scenario {
5353
}
5454

5555
const build_stderr = cat(path.join(currentJobDir, 'build.stderr')).toString()
56-
const stderr = build_stderr || cat((path.join(currentJobDir, 'run.stderr')).toString())
57-
58-
if (stderr) {
56+
if (build_stderr) {
5957
return {
6058
id: job.id,
61-
stderr,
59+
stderr: build_stderr,
6260
stdout: '',
6361
code: 12123,
6462
time: 1,
6563
score: 100
6664
}
6765
}
6866

69-
const build_stdout = cat(path.join(currentJobDir, 'build.stdout')).toString()
70-
const stdout = build_stdout || cat(path.join(currentJobDir, 'run.stdout')).toString()
67+
const stderr = cat((path.join(currentJobDir, 'run.stderr')).toString())
68+
const run_stdout = cat(path.join(currentJobDir, 'run.stdout')).toString()
7169

70+
// if code is set to 0, change the condition in judge-api queue logic
7271
return {
7372
id: job.id,
74-
stderr: '',
75-
stdout: stdout,
73+
stderr: stderr,
74+
stdout: run_stdout,
7675
time: 0,
77-
code: 10,
76+
code: 100,
7877
score: 100
7978
}
8079
}

0 commit comments

Comments
 (0)