mirror of
https://github.com/engineer-man/piston.git
synced 2025-06-09 03:26:27 +02:00
Combined memory limit parameters into one
This commit is contained in:
parent
badacca38f
commit
25c485f2ba
2 changed files with 8 additions and 7 deletions
|
@ -101,8 +101,10 @@ router.post('/execute', async function(req, res){
|
||||||
run: run_timeout || 3000,
|
run: run_timeout || 3000,
|
||||||
compile: compile_timeout || 10000
|
compile: compile_timeout || 10000
|
||||||
},
|
},
|
||||||
compile_memory_limit: compile_memory_limit || config.compile_memory_limit,
|
memory_limits: {
|
||||||
run_memory_limit: run_memory_limit || config.run_memory_limit
|
run: run_memory_limit || config.run_memory_limit,
|
||||||
|
compile: compile_memory_limit || config.compile_memory_limit
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await job.prime();
|
await job.prime();
|
||||||
|
|
|
@ -19,7 +19,7 @@ let gid = 0;
|
||||||
|
|
||||||
class Job {
|
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.uuid = uuidv4();
|
||||||
this.runtime = runtime;
|
this.runtime = runtime;
|
||||||
this.files = files.map((file,i) => ({
|
this.files = files.map((file,i) => ({
|
||||||
|
@ -30,8 +30,7 @@ class Job {
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.stdin = stdin;
|
this.stdin = stdin;
|
||||||
this.timeouts = timeouts;
|
this.timeouts = timeouts;
|
||||||
this.compile_memory_limit = compile_memory_limit;
|
this.memory_limits = memory_limits;
|
||||||
this.run_memory_limit = run_memory_limit;
|
|
||||||
|
|
||||||
this.uid = config.runner_uid_min + uid;
|
this.uid = config.runner_uid_min + uid;
|
||||||
this.gid = config.runner_gid_min + gid;
|
this.gid = config.runner_gid_min + gid;
|
||||||
|
@ -168,7 +167,7 @@ class Job {
|
||||||
path.join(this.runtime.pkgdir, 'compile'),
|
path.join(this.runtime.pkgdir, 'compile'),
|
||||||
this.files.map(x => x.name),
|
this.files.map(x => x.name),
|
||||||
this.timeouts.compile,
|
this.timeouts.compile,
|
||||||
this.compile_memory_limit
|
this.memory_limits.compile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +177,7 @@ class Job {
|
||||||
path.join(this.runtime.pkgdir, 'run'),
|
path.join(this.runtime.pkgdir, 'run'),
|
||||||
[this.files[0].name, ...this.args],
|
[this.files[0].name, ...this.args],
|
||||||
this.timeouts.run,
|
this.timeouts.run,
|
||||||
this.run_memory_limit
|
this.memory_limits.run
|
||||||
);
|
);
|
||||||
|
|
||||||
this.state = job_states.EXECUTED;
|
this.state = job_states.EXECUTED;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue