diff --git a/api/src/api/v2.js b/api/src/api/v2.js index a8fa9f0..f9a3f66 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -129,7 +129,7 @@ function get_job(body) { compile_timeout = compile_timeout || rt.timeouts.compile; run_timeout = run_timeout || rt.timeouts.run; compile_memory_limit = compile_memory_limit || rt.memory_limits.compile; - run_timeout = run_timeout || rt.timeouts.run; + run_memory_limit = run_memory_limit || rt.memory_limits.run; resolve( new Job({ runtime: rt, diff --git a/api/src/job.js b/api/src/job.js index c2e8bc8..2a9aa99 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -27,7 +27,7 @@ setInterval(() => { }, 10); class Job { - constructor({ runtime, files, args, stdin }) { + constructor({ runtime, files, args, stdin, timeouts, memory_limits }) { this.uuid = uuidv4(); this.runtime = runtime; this.files = files.map((file, i) => ({ @@ -38,6 +38,9 @@ class Job { this.args = args; this.stdin = stdin; + this.timeouts = timeouts; + this.memory_limits = memory_limits; + this.uid = config.runner_uid_min + uid; this.gid = config.runner_gid_min + gid; @@ -220,8 +223,8 @@ class Job { compile = await this.safe_call( path.join(this.runtime.pkgdir, 'compile'), this.files.map(x => x.name), - this.runtime.timeouts.compile, - this.runtime.memory_limits.compile + this.timeouts.compile, + this.memory_limits.compile ); } @@ -230,8 +233,8 @@ class Job { const run = await this.safe_call( path.join(this.runtime.pkgdir, 'run'), [this.files[0].name, ...this.args], - this.runtime.timeouts.run, - this.runtime.memory_limits.run + this.timeouts.run, + this.memory_limits.run ); this.state = job_states.EXECUTED; @@ -263,8 +266,8 @@ class Job { const { error, code, signal } = await this.safe_call( path.join(this.runtime.pkgdir, 'compile'), this.files.map(x => x.name), - this.runtime.timeouts.compile, - this.runtime.memory_limits.compile, + this.timeouts.compile, + this.memory_limits.compile, eventBus ); @@ -276,8 +279,8 @@ class Job { const { error, code, signal } = await this.safe_call( path.join(this.runtime.pkgdir, 'run'), [this.files[0].name, ...this.args], - this.runtime.timeouts.run, - this.runtime.memory_limits.run, + this.timeouts.run, + this.memory_limits.run, eventBus );