修复 /judger_run 使用 tmpfs 可能造成的内存占用过大的问题

This commit is contained in:
virusdefender 2018-05-05 14:59:20 +08:00
parent dca5db7348
commit d579874094
5 changed files with 10 additions and 11 deletions

1
.gitignore vendored
View File

@ -71,3 +71,4 @@ rsyncd.passwd
node_modules/
token.txt
run/

View File

@ -9,10 +9,8 @@ RUN buildDeps='software-properties-common git libtool cmake python-dev python3-p
cd /tmp && git clone -b newnew --depth 1 https://github.com/QingdaoU/Judger && cd Judger && \
mkdir build && cd build && cmake .. && make && make install && cd ../bindings/Python && python3 setup.py install && \
apt-get purge -y --auto-remove $buildDeps && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /judger_run /test_case /log /code && \
useradd -r compiler
apt-get clean && rm -rf /var/lib/apt/lists/* && \
mkdir -p /code && useradd -r compiler
HEALTHCHECK --interval=5s --retries=3 CMD python3 /code/service.py
ADD server /code

View File

@ -12,8 +12,6 @@ services:
- FSETID
tmpfs:
- /tmp
- /judger_run:exec,mode=777
- /spj:exec,mode=777
volumes:
- $PWD/tests/test_case:/test_case:ro
- $PWD/log:/log

View File

@ -3,7 +3,7 @@ import pwd
import grp
JUDGER_WORKSPACE_BASE = "/judger_run"
JUDGER_WORKSPACE_BASE = "/judger/run"
LOG_BASE = "/log"
COMPILER_LOG_PATH = os.path.join(LOG_BASE, "compile.log")
@ -17,5 +17,5 @@ COMPILER_USER_UID = pwd.getpwnam("compiler").pw_uid
COMPILER_GROUP_GID = grp.getgrnam("compiler").gr_gid
TEST_CASE_DIR = "/test_case"
SPJ_SRC_DIR = "/spj"
SPJ_EXE_DIR = "/spj"
SPJ_SRC_DIR = "/judger/spj"
SPJ_EXE_DIR = "/judger/spj"

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
chown compiler:compiler /spj
#!/bin/bash
rm -rf /judger/*
mkdir -p /judger/run /judger/spj
chown compiler:compiler /judger/spj
core=$(grep --count ^processor /proc/cpuinfo)
n=$(($core*2))
exec gunicorn --workers $n --threads $n --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:8080 server:app