Merge 4176e70509
into 59338eee33
This commit is contained in:
commit
5eb05be030
|
@ -0,0 +1 @@
|
|||
1. ~~add time format line (https://www.man7.org/linux/man-pages/man1/time.1.html#top_of_page)~~
|
|
@ -13,7 +13,7 @@ RUN apt-get update && \
|
|||
libncurses6 libncurses5 libedit-dev libseccomp-dev rename procps python3 \
|
||||
libreadline-dev libblas-dev liblapack-dev libpcre3-dev libarpack2-dev \
|
||||
libfftw3-dev libglpk-dev libqhull-dev libqrupdate-dev libsuitesparse-dev \
|
||||
libsundials-dev libpcre2-dev && \
|
||||
libsundials-dev libpcre2-dev time && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
||||
|
|
|
@ -154,6 +154,13 @@ class Job {
|
|||
Math.ceil(timeout / 1000),
|
||||
];
|
||||
|
||||
const time_format = [
|
||||
'-f',
|
||||
// https://www.man7.org/linux/man-pages/man1/time.1.html#top_of_page
|
||||
// elapsed user system memory
|
||||
'%es %Us %Ss %MKb',
|
||||
]
|
||||
|
||||
if (memory_limit >= 0) {
|
||||
prlimit.push('--as=' + memory_limit);
|
||||
}
|
||||
|
@ -163,6 +170,8 @@ class Job {
|
|||
...timeout_call,
|
||||
...prlimit,
|
||||
...nonetwork,
|
||||
'time',
|
||||
...time_format,
|
||||
'bash',
|
||||
file,
|
||||
...args,
|
||||
|
@ -172,6 +181,8 @@ class Job {
|
|||
var stderr = '';
|
||||
var output = '';
|
||||
|
||||
var start_time = new Date().getTime();
|
||||
|
||||
const proc = cp.spawn(proc_call[0], proc_call.splice(1), {
|
||||
env: {
|
||||
...this.runtime.env_vars,
|
||||
|
@ -265,14 +276,48 @@ class Job {
|
|||
proc.on('close', (code, signal) => {
|
||||
this.close_cleanup();
|
||||
|
||||
resolve({ stdout, stderr, code, signal, output });
|
||||
if (stderr.length > 0) {
|
||||
var stats = stderr.trim().split('\n').slice(-1).join('\n').split(' ');
|
||||
|
||||
stderr = stderr.trim().split('\n').slice(0, -1).join('\n');
|
||||
output = output.trim().split('\n').slice(0, -1).join('\n');
|
||||
|
||||
stats = {
|
||||
'elapsed_time': stats[0],
|
||||
'cpu_time': stats[1] + ' / ' + stats[2],
|
||||
'max_mem': stats[3],
|
||||
}
|
||||
}
|
||||
|
||||
var end_time = new Date().getTime();
|
||||
var exec_time = end_time - start_time;
|
||||
|
||||
this.logger.debug(`Stats:`, stats);
|
||||
resolve({ stdout, stderr, code, signal, output, stats, exec_time });
|
||||
});
|
||||
|
||||
proc.on('error', err => {
|
||||
this.exit_cleanup();
|
||||
this.close_cleanup();
|
||||
|
||||
reject({ error: err, stdout, stderr, output });
|
||||
if (stderr.length > 0) {
|
||||
var stats = stderr.trim().split('\n').slice(-1).join('\n').split(' ');
|
||||
|
||||
stderr = stderr.trim().split('\n').slice(0, -1).join('\n');
|
||||
output = output.trim().split('\n').slice(0, -1).join('\n');
|
||||
|
||||
stats = {
|
||||
'elapsed_time': stats[0],
|
||||
'cpu_time': stats[1] + ' / ' + stats[2],
|
||||
'max_mem': stats[3],
|
||||
}
|
||||
}
|
||||
|
||||
var end_time = new Date().getTime();
|
||||
var exec_time = end_time - start_time;
|
||||
|
||||
this.logger.debug(`Stats:`, stats);
|
||||
reject({ error: err, stdout, stderr, output, stats, exec_time });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,13 +12,14 @@ services:
|
|||
volumes:
|
||||
- ./data/piston/packages:/piston/packages
|
||||
environment:
|
||||
- PISTON_REPO_URL=http://repo:8000/index
|
||||
- PISTON_REPO_URL=https://github.com/engineer-man/piston/releases/download/pkgs/index
|
||||
tmpfs:
|
||||
- /piston/jobs:exec,uid=1000,gid=1000,mode=711
|
||||
|
||||
repo: # Local testing of packages
|
||||
repo:
|
||||
# Local testing of packages
|
||||
build: repo
|
||||
container_name: piston_repo
|
||||
command: ['--no-build'] # Don't build anything
|
||||
command: [ '--no-build' ] # Don't build anything
|
||||
volumes:
|
||||
- .:/piston
|
||||
|
|
Loading…
Reference in New Issue