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)~~
|
|
@ -4,8 +4,8 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN dpkg-reconfigure -p critical dash
|
RUN dpkg-reconfigure -p critical dash
|
||||||
RUN for i in $(seq 1001 1500); do \
|
RUN for i in $(seq 1001 1500); do \
|
||||||
groupadd -g $i runner$i && \
|
groupadd -g $i runner$i && \
|
||||||
useradd -M runner$i -g $i -u $i ; \
|
useradd -M runner$i -g $i -u $i ; \
|
||||||
done
|
done
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y libxml2 gnupg tar coreutils util-linux libc6-dev \
|
apt-get install -y libxml2 gnupg tar coreutils util-linux libc6-dev \
|
||||||
|
@ -13,7 +13,7 @@ RUN apt-get update && \
|
||||||
libncurses6 libncurses5 libedit-dev libseccomp-dev rename procps python3 \
|
libncurses6 libncurses5 libedit-dev libseccomp-dev rename procps python3 \
|
||||||
libreadline-dev libblas-dev liblapack-dev libpcre3-dev libarpack2-dev \
|
libreadline-dev libblas-dev liblapack-dev libpcre3-dev libarpack2-dev \
|
||||||
libfftw3-dev libglpk-dev libqhull-dev libqrupdate-dev libsuitesparse-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/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
||||||
|
|
|
@ -154,6 +154,13 @@ class Job {
|
||||||
Math.ceil(timeout / 1000),
|
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) {
|
if (memory_limit >= 0) {
|
||||||
prlimit.push('--as=' + memory_limit);
|
prlimit.push('--as=' + memory_limit);
|
||||||
}
|
}
|
||||||
|
@ -163,6 +170,8 @@ class Job {
|
||||||
...timeout_call,
|
...timeout_call,
|
||||||
...prlimit,
|
...prlimit,
|
||||||
...nonetwork,
|
...nonetwork,
|
||||||
|
'time',
|
||||||
|
...time_format,
|
||||||
'bash',
|
'bash',
|
||||||
file,
|
file,
|
||||||
...args,
|
...args,
|
||||||
|
@ -172,6 +181,8 @@ class Job {
|
||||||
var stderr = '';
|
var stderr = '';
|
||||||
var output = '';
|
var output = '';
|
||||||
|
|
||||||
|
var start_time = new Date().getTime();
|
||||||
|
|
||||||
const proc = cp.spawn(proc_call[0], proc_call.splice(1), {
|
const proc = cp.spawn(proc_call[0], proc_call.splice(1), {
|
||||||
env: {
|
env: {
|
||||||
...this.runtime.env_vars,
|
...this.runtime.env_vars,
|
||||||
|
@ -265,14 +276,48 @@ class Job {
|
||||||
proc.on('close', (code, signal) => {
|
proc.on('close', (code, signal) => {
|
||||||
this.close_cleanup();
|
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 => {
|
proc.on('error', err => {
|
||||||
this.exit_cleanup();
|
this.exit_cleanup();
|
||||||
this.close_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:
|
volumes:
|
||||||
- ./data/piston/packages:/piston/packages
|
- ./data/piston/packages:/piston/packages
|
||||||
environment:
|
environment:
|
||||||
- PISTON_REPO_URL=http://repo:8000/index
|
- PISTON_REPO_URL=https://github.com/engineer-man/piston/releases/download/pkgs/index
|
||||||
tmpfs:
|
tmpfs:
|
||||||
- /piston/jobs:exec,uid=1000,gid=1000,mode=711
|
- /piston/jobs:exec,uid=1000,gid=1000,mode=711
|
||||||
|
|
||||||
repo: # Local testing of packages
|
repo:
|
||||||
|
# Local testing of packages
|
||||||
build: repo
|
build: repo
|
||||||
container_name: piston_repo
|
container_name: piston_repo
|
||||||
command: ['--no-build'] # Don't build anything
|
command: [ '--no-build' ] # Don't build anything
|
||||||
volumes:
|
volumes:
|
||||||
- .:/piston
|
- .:/piston
|
||||||
|
|
Loading…
Reference in New Issue