Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
codejail
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
codejail
Commits
251765c7
Commit
251765c7
authored
Feb 07, 2018
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge in changes from edx-platform-master branch which specify
the number of processes and threads to allow.
parent
8228553c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
codejail/limits.py
+10
-2
No files found.
codejail/limits.py
View file @
251765c7
...
...
@@ -14,6 +14,8 @@ LIMITS = {
"VMEM"
:
0
,
# Size of files creatable, in bytes, defaulting to nothing can be written.
"FSIZE"
:
0
,
# The number of processes and threads to allow.
"NPROC"
:
15
,
# Whether to use a proxy process or not. None means use an environment
# variable to decide. NOTE: using a proxy process is NOT THREAD-SAFE, only
# one thread can use CodeJail at a time if you are using a proxy process.
...
...
@@ -43,6 +45,9 @@ def set_limit(limit_name, value):
* `"FSIZE"`: the maximum size of files creatable by the jailed code,
in bytes. The default is 0 (no files may be created).
* `"NPROC"`: the maximum number of process or threads creatable by the
jailed code. The default is 15.
* `"PROXY"`: 1 to use a proxy process, 0 to not use one. This isn't
really a limit, sorry about that.
...
...
@@ -59,8 +64,11 @@ def create_rlimits():
"""
rlimits
=
[]
# No subprocesses.
rlimits
.
append
((
resource
.
RLIMIT_NPROC
,
(
0
,
0
)))
# Allow a small number of subprocess and threads. One limit controls both,
# and at least OpenBLAS (imported by numpy) requires threads.
nproc
=
LIMITS
[
"NPROC"
]
if
nproc
:
rlimits
.
append
((
resource
.
RLIMIT_NPROC
,
(
nproc
,
nproc
)))
# CPU seconds, not wall clock time.
cpu
=
LIMITS
[
"CPU"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment