Combined memory limit parameters into one

This commit is contained in:
Defelo 2021-05-07 10:17:37 +02:00
parent badacca38f
commit 25c485f2ba
No known key found for this signature in database
GPG key ID: 99184F5FDC589A67
2 changed files with 8 additions and 7 deletions

View file

@ -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();

View file

@ -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;