From 25c485f2baad2a1a0fb10076a9905b36240e02d9 Mon Sep 17 00:00:00 2001 From: Defelo Date: Fri, 7 May 2021 10:17:37 +0200 Subject: [PATCH] Combined memory limit parameters into one --- api/src/api/v2.js | 6 ++++-- api/src/job.js | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 919d54d..3633b04 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -101,8 +101,10 @@ router.post('/execute', async function(req, res){ run: run_timeout || 3000, compile: compile_timeout || 10000 }, - compile_memory_limit: compile_memory_limit || config.compile_memory_limit, - run_memory_limit: run_memory_limit || config.run_memory_limit + memory_limits: { + run: run_memory_limit || config.run_memory_limit, + compile: compile_memory_limit || config.compile_memory_limit + } }); await job.prime(); diff --git a/api/src/job.js b/api/src/job.js index f45b7a4..f1420a0 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -19,7 +19,7 @@ let gid = 0; class Job { - constructor({ runtime, files, args, stdin, timeouts, compile_memory_limit, run_memory_limit }) { + constructor({ runtime, files, args, stdin, timeouts, memory_limits }) { this.uuid = uuidv4(); this.runtime = runtime; this.files = files.map((file,i) => ({ @@ -30,8 +30,7 @@ class Job { this.args = args; this.stdin = stdin; this.timeouts = timeouts; - this.compile_memory_limit = compile_memory_limit; - this.run_memory_limit = run_memory_limit; + this.memory_limits = memory_limits; this.uid = config.runner_uid_min + uid; this.gid = config.runner_gid_min + gid; @@ -168,7 +167,7 @@ class Job { path.join(this.runtime.pkgdir, 'compile'), this.files.map(x => x.name), this.timeouts.compile, - this.compile_memory_limit + this.memory_limits.compile ); } @@ -178,7 +177,7 @@ class Job { path.join(this.runtime.pkgdir, 'run'), [this.files[0].name, ...this.args], this.timeouts.run, - this.run_memory_limit + this.memory_limits.run ); this.state = job_states.EXECUTED;