Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
04dd61be
Commit
04dd61be
authored
May 18, 2016
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove logging
parent
a7d638de
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
42 deletions
+1
-42
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+0
-25
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
+1
-17
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
04dd61be
...
...
@@ -62,7 +62,6 @@ from importlib import import_module
from
mongodb_proxy
import
autoretry_read
from
path
import
Path
as
path
from
pytz
import
UTC
import
traceback
from
bson.objectid
import
ObjectId
from
xblock.core
import
XBlock
...
...
@@ -688,10 +687,6 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
if
self
.
request_cache
is
not
None
:
self
.
services
[
"request_cache"
]
=
self
.
request_cache
# set the maximum number of courses we expect
# to see in the request cache
self
.
max_num_courses_in_cache
=
10
self
.
signal_handler
=
signal_handler
def
close_connections
(
self
):
...
...
@@ -800,26 +795,6 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
"""
if
self
.
request_cache
is
not
None
:
self
.
request_cache
.
data
.
setdefault
(
'course_cache'
,
{})[
course_version_guid
]
=
system
number_courses_in_cache
=
len
(
self
.
request_cache
.
data
[
'course_cache'
])
if
number_courses_in_cache
>
self
.
max_num_courses_in_cache
:
# We shouldn't have any scenarios where there are many
# courses in the request cache. If there are, it's probably
# indicative of a leak. In this case, we should log that here
# with a stacktrace.
course_structure_ids
=
self
.
request_cache
.
data
[
'course_cache'
]
.
keys
()[:
10
]
log
.
warning
(
(
"There are more than
%
d (
%
d) "
"courses in the request cache. This may be indicative "
"of a memory leak.
\n\n
Here are some of the course "
"structures' mongo ids that are now in the cache:
%
s
\n\n
"
"And here's the current stack:
\n
%
s"
),
self
.
max_num_courses_in_cache
,
number_courses_in_cache
,
", "
.
join
(
unicode
(
structure_id
)
for
structure_id
in
course_structure_ids
),
""
.
join
(
traceback
.
format_stack
()[
-
10
:])
)
return
system
def
_clear_cache
(
self
,
course_version_guid
=
None
):
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
View file @
04dd61be
"""
Test split modulestore w/o using any django stuff.
"""
from
mock
import
patch
,
Mock
from
mock
import
patch
import
datetime
from
importlib
import
import_module
from
path
import
Path
as
path
...
...
@@ -627,22 +627,6 @@ class SplitModuleCourseTests(SplitModuleTest):
self
.
assertEqual
(
course
.
edited_by
,
"testassist@edx.org"
)
self
.
assertDictEqual
(
course
.
grade_cutoffs
,
{
"Pass"
:
0.45
})
@ddt.data
((
10
,
0
),
(
2
,
1
))
@ddt.unpack
@patch
(
"xmodule.modulestore.split_mongo.split.log.warning"
)
def
test_request_cache_max_courses
(
self
,
max_courses
,
expected_warnings
,
mock_log
):
"""
Test that we warn if there are too many courses in the request cache
at once.
"""
mock_request_cache
=
Mock
()
mock_request_cache
.
data
=
{}
modulestore
()
.
max_num_courses_in_cache
=
max_courses
modulestore
()
.
request_cache
=
mock_request_cache
modulestore
()
.
get_courses
(
branch
=
BRANCH_NAME_DRAFT
)
self
.
assertEqual
(
mock_log
.
call_count
,
expected_warnings
)
@patch
(
'xmodule.tabs.CourseTab.from_json'
,
side_effect
=
mock_tab_from_json
)
def
test_get_courses_with_same_course_index
(
self
,
_from_json
):
"""
...
...
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