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
e7172446
Commit
e7172446
authored
Apr 05, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove discussion cache, which isn't used
parent
f84eaf01
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
75 deletions
+12
-75
cms/one_time_startup.py
+2
-7
common/djangoapps/cache_toolbox/discussion_cache.py
+0
-55
common/lib/xmodule/xmodule/editing_module.py
+4
-2
common/lib/xmodule/xmodule/modulestore/mongo.py
+6
-10
lms/djangoapps/django_comment_client/utils.py
+0
-1
No files found.
cms/one_time_startup.py
View file @
e7172446
from
dogapi
import
dog_http_api
,
dog_stats_api
from
django.conf
import
settings
from
xmodule.modulestore.django
import
modulestore
from
cache_toolbox.discussion_cache
import
discussion_cache_register_for_updates
from
django.dispatch
import
Signal
from
request_cache.middleware
import
RequestCache
from
django.core.cache
import
get_cache
,
InvalidCacheBackendError
from
django.core.cache
import
get_cache
cache
=
get_cache
(
'mongo_metadata_inheritance'
)
for
store_name
in
settings
.
MODULESTORE
:
...
...
@@ -13,12 +12,8 @@ for store_name in settings.MODULESTORE:
store
.
metadata_inheritance_cache_subsystem
=
cache
store
.
request_cache
=
RequestCache
.
get_request_cache
()
modulestore_update_signal
=
Signal
(
providing_args
=
[
'modulestore'
,
'course_id'
,
'location'
]
)
modulestore_update_signal
=
Signal
(
providing_args
=
[
'modulestore'
,
'course_id'
,
'location'
])
store
.
modulestore_update_signal
=
modulestore_update_signal
discussion_cache_register_for_updates
(
store
)
if
hasattr
(
settings
,
'DATADOG_API'
):
dog_http_api
.
api_key
=
settings
.
DATADOG_API
dog_stats_api
.
start
(
api_key
=
settings
.
DATADOG_API
,
statsd
=
True
)
common/djangoapps/cache_toolbox/discussion_cache.py
deleted
100644 → 0
View file @
f84eaf01
import
logging
from
django.core.cache
import
cache
,
get_cache
from
datetime
import
datetime
def
_get_discussion_cache
():
return
get_cache
(
'mongo_metadata_inheritance'
)
def
get_discussion_cache_key
(
course_id
):
return
'discussion_items_{0}'
.
format
(
course_id
)
def
get_discussion_cache_entry
(
modulestore
,
course_id
):
cache_entry
=
None
cache
=
_get_discussion_cache
()
if
cache
is
not
None
:
cache_entry
=
cache
.
get
(
get_discussion_cache_key
(
course_id
),
None
)
# @todo: add expiry here
if
cache_entry
is
None
:
cache_entry
=
generate_discussion_cache_entry
(
modulestore
,
course_id
)
return
cache_entry
.
get
(
'modules'
,[])
def
generate_discussion_cache_entry
(
modulestore
,
course_id
):
# make this a NOP for now. We have to figure out how to pickle the result set
return
components
=
course_id
.
split
(
'/'
)
all_discussion_modules
=
modulestore
.
get_items
([
'i4x'
,
components
[
0
],
components
[
1
],
'discussion'
,
None
],
course_id
=
course_id
)
cache
=
_get_discussion_cache
()
entry
=
{
'modules'
:
all_discussion_modules
,
'timestamp'
:
datetime
.
now
()}
if
cache
is
not
None
:
cache
.
set
(
get_discussion_cache_key
(
course_id
),
entry
)
return
entry
def
modulestore_update_signal_handler
(
modulestore
=
None
,
course_id
=
None
,
location
=
None
,
**
kwargs
):
"""called when there is an write event in our modulestore
"""
return
if
location
.
category
==
'discussion'
:
logging
.
debug
(
'******* got modulestore update signal. Regenerating discussion cache for {0}'
.
format
(
course_id
))
# refresh the cache entry if we've changed a discussion module
generate_discussion_cache_entry
(
modulestore
,
course_id
)
def
discussion_cache_register_for_updates
(
modulestore
):
if
modulestore
.
modulestore_update_signal
is
not
None
:
modulestore
.
modulestore_update_signal
.
connect
(
modulestore_update_signal_handler
)
\ No newline at end of file
common/lib/xmodule/xmodule/editing_module.py
View file @
e7172446
...
...
@@ -40,10 +40,11 @@ class XMLEditingDescriptor(EditingDescriptor):
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/raw/edit/xml.coffee'
)]}
js_module_name
=
"XMLEditingDescriptor"
class
MetadataOnlyEditingDescriptor
(
EditingDescriptor
):
"""
Module
that provides a raw editing view of its data as XML. It does not perform
any validation of its definition
Module
which only provides an editing interface for the metadata, it does
not expose a UI for editing the module data
"""
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/raw/edit/metadata-only.coffee'
)]}
...
...
@@ -51,6 +52,7 @@ class MetadataOnlyEditingDescriptor(EditingDescriptor):
mako_template
=
"widgets/metadata-only-edit.html"
class
JSONEditingDescriptor
(
EditingDescriptor
):
"""
Module that provides a raw editing view of its data as XML. It does not perform
...
...
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
e7172446
...
...
@@ -329,7 +329,7 @@ class MongoModuleStore(ModuleStoreBase):
'''
key
=
metadata_cache_key
(
location
)
tree
=
{}
if
not
force_refresh
:
# see if we are first in the request cache (if present)
if
self
.
request_cache
is
not
None
and
key
in
self
.
request_cache
.
data
.
get
(
'metadata_inheritance'
,
{}):
...
...
@@ -344,7 +344,7 @@ class MongoModuleStore(ModuleStoreBase):
if
not
tree
:
# if not in subsystem, or we are on force refresh, then we have to compute
tree
=
self
.
compute_metadata_inheritance_tree
(
location
)
# now write out computed tree to caching subsystem (e.g. memcached), if available
if
self
.
metadata_inheritance_cache_subsystem
is
not
None
:
self
.
metadata_inheritance_cache_subsystem
.
set
(
key
,
tree
)
...
...
@@ -578,11 +578,8 @@ class MongoModuleStore(ModuleStoreBase):
def
fire_updated_modulestore_signal
(
self
,
course_id
,
location
):
if
self
.
modulestore_update_signal
is
not
None
:
self
.
modulestore_update_signal
.
send
(
None
,
modulestore
=
self
,
course_id
=
course_id
,
location
=
location
)
self
.
modulestore_update_signal
.
send
(
self
,
modulestore
=
self
,
course_id
=
course_id
,
location
=
location
)
def
get_course_for_item
(
self
,
location
,
depth
=
0
):
'''
...
...
@@ -682,8 +679,7 @@ class MongoModuleStore(ModuleStoreBase):
self
.
_update_single_item
(
location
,
{
'metadata'
:
metadata
})
# recompute (and update) the metadata inheritance tree which is cached
self
.
refresh_cached_metadata_inheritance_tree
(
loc
)
self
.
fire_updated_modulestore_signal
(
get_course_id_no_run
(
Location
(
location
)),
Location
(
location
))
self
.
fire_updated_modulestore_signal
(
get_course_id_no_run
(
Location
(
location
)),
Location
(
location
))
def
delete_item
(
self
,
location
):
"""
...
...
@@ -707,7 +703,7 @@ class MongoModuleStore(ModuleStoreBase):
safe
=
self
.
collection
.
safe
)
# recompute (and update) the metadata inheritance tree which is cached
self
.
refresh_cached_metadata_inheritance_tree
(
Location
(
location
))
self
.
fire_updated_modulestore_signal
(
get_course_id_no_run
(
Location
(
location
)),
Location
(
location
))
self
.
fire_updated_modulestore_signal
(
get_course_id_no_run
(
Location
(
location
)),
Location
(
location
))
def
get_parent_locations
(
self
,
location
,
course_id
):
'''Find all locations that are the parents of this location in this
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
e7172446
...
...
@@ -16,7 +16,6 @@ from django.utils import simplejson
from
django_comment_client.models
import
Role
from
django_comment_client.permissions
import
check_permissions_by_view
from
xmodule.modulestore.exceptions
import
NoPathToItem
from
cache_toolbox.discussion_cache
import
get_discussion_cache_entry
from
mitxmako
import
middleware
import
pystache_custom
as
pystache
...
...
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