forked from USTB-LETTers/judger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
64 lines (42 loc) · 1.51 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- coding: utf-8 -*-
import os
import logging
import logzero
from logzero import logger, LogFormatter
DEBUG = True
TEST_DATA_DIR = os.path.join(os.getcwd(), 'test_data')
JUDGE_TOKEN = 'set this to random for token'
TEMP_DIR = os.path.join(os.getcwd(), 'temp')
WORKING_DIR = '/crazybox/'
if not os.path.isdir(TEMP_DIR):
os.mkdir(TEMP_DIR)
if not os.path.isdir(TEST_DATA_DIR):
os.mkdir(TEST_DATA_DIR)
CPU_TO_REAL_TIME_FACTOR = 3
DEFAULT_GENERATE_FILE_SIZE = 256 * 1024 * 1024 # 256M
DEFAULT_LIMITS = {
# CPU time in seconds, None for unlimited
'cpu_time': 1,
# Real time in seconds, None for unlimited
'real_time': 5,
# Memory in megabytes, None for unlimited
'memory': 64,
# Allow user process to fork
# 'can_fork': False,
# Limiting the maximum number of user processes in Linux is tricky.
# http://unix.stackexchange.com/questions/55319/are-limits-conf-values-applied-on-a-per-process-basis
}
if DEBUG:
logzero.loglevel(logging.DEBUG)
else:
logzero.loglevel(logging.WARNING)
fmt = '%(color)s[%(asctime)s <%(module)s:%(funcName)s>:%(lineno)d] [%(levelname)s]%(end_color)s - %(message)s'
formatter = LogFormatter(color=True, datefmt='%Y%m%d %H:%M:%S', fmt=fmt)
logzero.formatter(formatter)
logzero.logfile(filename='crazybox.log', maxBytes=1000000, backupCount=3, loglevel=logging.WARNING)
logger.debug("start crazybox")
def fuc():
logger.debug("start fuc")
if __name__ == '__main__':
print("中文测试 " + os.path.join(os.getcwd(), 'tmp'))
fuc()