-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbase.py
More file actions
179 lines (157 loc) · 4.51 KB
/
Copy pathbase.py
File metadata and controls
179 lines (157 loc) · 4.51 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import os
from datetime import timedelta
PACKAGE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(
os.path.realpath(__file__))))
DEBUG = False
RPC_TRANSPORT_URL = 'rabbit://guest:guest@localhost:5672//'
RPC_DEFAULT_TIMEOUT = 305
USE_RPC_TIMEOUT_KILLER = True
#: See the `RAID_OLD_STYLE_CLEAN_REPLY_QUIZZES` option in edy settings.
OLD_STYLE_CLEAN_REPLY_QUIZZES = ['admin', 'chemical', 'choice', 'code', 'dataset', 'fill-blanks',
'linux-code', 'matching', 'math', 'number', 'puzzle',
'random-tasks', 'schulte', 'sorting', 'sql', 'table', 'trik']
USE_EPICBOX = False
# use current user to execute `sandboxed` code.
SANDBOX_USER = None
SANDBOX_FOLDER = os.path.join(PACKAGE_ROOT, 'sandbox')
SANDBOX_PYTHON = os.path.join(SANDBOX_FOLDER, 'python', 'bin', 'python3')
SANDBOX_JAVA = None
SANDBOX_JAVA_HOME = None
SANDBOX_JAVA8 = None
SANDBOX_ENV = {
'LANG': 'en_US.UTF-8',
}
ARENA_DIR = os.path.join(PACKAGE_ROOT, 'arena')
MB = 1024 * 1024
JAVA_RESERVED_MEMORY = 400 * MB
JAVA_DISASSEMBLE_TIMEOUT = 5
SANDBOX_LIMITS = {
'TIME': 120,
'MEMORY': 512 * MB,
'CAN_FORK': False,
'FILE_SIZE': 0
}
COMPILERS = {
}
INTERPRETERS = {
}
COMPILER_LIMITS = {
'TIME': 60,
'MEMORY': 512 * MB,
'CAN_FORK': True,
'FILE_SIZE': 256 * MB
}
USER_CODE_LIMITS = {
'TIME': 10,
'MEMORY': 512 * MB,
'CAN_FORK': False,
'FILE_SIZE': 0
}
EPICBOX_BASE_PROFILES = {
'base': {
'docker_image': 'stepik/epicbox-base:alpine',
'user': 'sandbox',
'read_only': True,
},
'base_root': {
'docker_image': 'stepik/epicbox-base:alpine',
},
}
EPICBOX_PROFILES = {}
EPICBOX_DOCKER_URL = 'unix:///var/run/docker.sock'
EPICBOX_BASE_WORKDIR = None
EPICBOX_COMPILE_LIMITS = {
'cputime': 30,
'realtime': 60,
'memory': 512,
}
EPICBOX_TRIK_LIMITS = {
'cputime': 60,
'realtime': 120,
'memory': 512,
}
#: Specify epicbox configs for languages. Epicbox sandboxes are used
#: for these languages instead of codejail.
CODE_LANGUAGES = {}
DATASET_QUIZ_TIME_LIMIT = timedelta(minutes=5)
DATASET_QUIZ_SIZE_LIMIT = 10 * MB
SQL_DOCKER_HOST = 'unix:///var/run/docker.sock'
SQL_CONTAINER_IMAGE = 'mysql:5.7.12'
SQL_CONTAINER_NAME = 'sql-challenge'
SQL_CONTAINER_PORT = 3306
SQL_CONTAINER_VOLUME = '/var/lib/mysql'
SQL_BIND_HOST = '127.0.0.1'
SQL_BIND_PORT = 13306
SQL_DB_CONF_OPTIONS = '--skip-innodb_adaptive_hash_index'
SQL_DB_HOST = '127.0.0.1'
SQL_DB_ROOT_PASS = 'root'
SQL_MAX_EXECUTION_TIME = 30
SQL_QUERY_RESULT_MAX_SIZE = 100
LINUX_CODE_API_URL = ''
# These quizzes will be scored in edy in a separate celery queue.
COMPUTATIONALLY_HARD_QUIZZES = ['admin', 'code', 'dataset']
ROOTNROLL_API_URL = ''
ROOTNROLL_USERNAME = ''
ROOTNROLL_PASSWORD = ''
LOGGING_CONFIGURE = True
LOGGING_JSON = False
LOGGING_SENTRY = False
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '[%(asctime)s] [%(name)s] %(levelname)s %(message)s'
},
'structlog_json': {
'()': 'stepic_plugins.log.LoggingJsonFormatter',
'format': '%(message)s'
}
},
'filters': {
'require_logging_json_true': {
'()': 'stepic_plugins.log.RequireLoggingJsonTrue'
},
'require_logging_json_false': {
'()': 'stepic_plugins.log.RequireLoggingJsonFalse'
},
'require_logging_sentry_true': {
'()': 'stepic_plugins.log.RequireLoggingSentryTrue'
},
},
'handlers': {
'sentry': {
'level': 'ERROR',
'filters': ['require_logging_sentry_true'],
'class': 'raven.handlers.logging.SentryHandler',
'dsn': '',
},
'console': {
'level': 'DEBUG',
'filters': ['require_logging_json_false'],
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'console_json': {
'level': 'DEBUG',
'filters': ['require_logging_json_true'],
'class': 'logging.StreamHandler',
'formatter': 'structlog_json',
},
},
'loggers': {
'py.warnings': {
'handlers': ['console'],
'propagate': False,
},
'stepic_plugins': {
'handlers': ['console', 'console_json', 'sentry'],
'level': 'INFO',
'propagate': False,
},
'': {
'handlers': ['console', 'console_json', 'sentry'],
'level': 'INFO',
},
}
}