Add more configurations
This commit is contained in:
parent
39edb5b29a
commit
03a241086e
2 changed files with 7 additions and 4 deletions
|
@ -6,5 +6,8 @@
|
|||
"haskell",
|
||||
"python",
|
||||
"Leave empty to enable all languages"
|
||||
]
|
||||
],
|
||||
"memory": "128m",
|
||||
"cpus": "0.5",
|
||||
"timeout": 10000
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class LanguageHandler extends AkairoHandler {
|
|||
const { id, env } = language.runWith(options);
|
||||
const proc = childProcess.spawn('docker', [
|
||||
'run', '--rm', `--name=${name}`,
|
||||
'--net=none', '--cpus=0.5', '-m=256m',
|
||||
'--net=none', `--cpus=${this.client.config.cpus}`, `-m=${this.client.config.memory}`,
|
||||
...Object.entries(env).map(([k, v]) => `-e${k}=${v}`),
|
||||
`1computer1/comp_iler:${id}`,
|
||||
'/bin/sh', '/var/run/run.sh', code
|
||||
|
@ -79,11 +79,11 @@ class LanguageHandler extends AkairoHandler {
|
|||
childProcess.execSync(`docker kill --signal=9 ${name} >/dev/null 2>/dev/null`);
|
||||
}
|
||||
|
||||
reject(new Error('Evaluation timed out'));
|
||||
reject(new Error('Timed out'));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}, 10000);
|
||||
}, this.client.config.timeout);
|
||||
|
||||
let data = '';
|
||||
proc.stdout.on('data', chunk => {
|
||||
|
|
Loading…
Reference in a new issue