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
328a79cc
Commit
328a79cc
authored
Oct 14, 2014
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap pymongo connections in MongoProxy.
PLAT-71
parent
cb5e90fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
23 deletions
+31
-23
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+29
-22
common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
+1
-1
requirements/edx/github.txt
+1
-0
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
328a79cc
...
...
@@ -20,34 +20,37 @@ import re
from
uuid
import
uuid4
from
bson.son
import
SON
from
contracts
import
contract
,
new_contract
from
datetime
import
datetime
from
fs.osfs
import
OSFS
from
mongodb_proxy
import
MongoProxy
,
autoretry_read
from
path
import
path
from
datetime
import
datetime
from
pytz
import
UTC
from
contracts
import
contract
,
new_contract
from
operator
import
itemgetter
from
sortedcontainers
import
SortedListWithKey
from
importlib
import
import_module
from
xmodule.errortracker
import
null_error_tracker
,
exc_info_to_str
from
xmodule.mako_module
import
MakoDescriptorSystem
from
xmodule.error_module
import
ErrorDescriptor
from
xblock.runtime
import
KvsFieldData
from
opaque_keys.edx.keys
import
UsageKey
,
CourseKey
,
AssetKey
from
opaque_keys.edx.locations
import
Location
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locator
import
CourseLocator
from
xblock.core
import
XBlock
from
xblock.exceptions
import
InvalidScopeError
from
xblock.fields
import
Scope
,
ScopeIds
,
Reference
,
ReferenceList
,
ReferenceValueDict
from
xblock.runtime
import
KvsFieldData
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.errortracker
import
null_error_tracker
,
exc_info_to_str
from
xmodule.exceptions
import
HeartbeatFailure
from
xmodule.mako_module
import
MakoDescriptorSystem
from
xmodule.modulestore
import
ModuleStoreWriteBase
,
ModuleStoreEnum
,
BulkOperationsMixin
,
BulkOpsRecord
from
xmodule.modulestore.draft_and_published
import
ModuleStoreDraftAndPublished
,
DIRECT_ONLY_CATEGORIES
from
opaque_keys.edx.locations
import
Locatio
n
from
xmodule.modulestore.edit_info
import
EditInfoRuntimeMixi
n
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
DuplicateCourseError
,
ReferentialIntegrityError
from
xmodule.modulestore.inheritance
import
InheritanceMixin
,
inherit_metadata
,
InheritanceKeyValueStore
from
xblock.core
import
XBlock
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locator
import
CourseLocator
from
opaque_keys.edx.keys
import
UsageKey
,
CourseKey
,
AssetKey
from
xmodule.exceptions
import
HeartbeatFailure
from
xmodule.modulestore.edit_info
import
EditInfoRuntimeMixin
from
xmodule.assetstore
import
AssetMetadata
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -442,6 +445,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
error_tracker
=
null_error_tracker
,
i18n_service
=
None
,
fs_service
=
None
,
retry_wait_time
=
0.1
,
**
kwargs
):
"""
:param doc_store_config: must have a host, db, and collection entries. Other common entries: port, tz_aware.
...
...
@@ -455,15 +459,18 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
"""
Create & open the connection, authenticate, and provide pointers to the collection
"""
self
.
database
=
pymongo
.
database
.
Database
(
pymongo
.
MongoClient
(
host
=
host
,
port
=
port
,
tz_aware
=
tz_aware
,
document_class
=
dict
,
**
kwargs
self
.
database
=
MongoProxy
(
pymongo
.
database
.
Database
(
pymongo
.
MongoClient
(
host
=
host
,
port
=
port
,
tz_aware
=
tz_aware
,
document_class
=
dict
,
**
kwargs
),
db
),
db
wait_time
=
retry_wait_time
)
self
.
collection
=
self
.
database
[
collection
]
...
...
@@ -516,7 +523,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
super
(
MongoModuleStore
,
self
)
.
_drop_database
()
connection
=
self
.
collection
.
database
.
connection
connection
.
drop_database
(
self
.
collection
.
database
)
connection
.
drop_database
(
self
.
collection
.
database
.
proxied_object
)
connection
.
close
()
def
fill_in_run
(
self
,
course_key
):
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
View file @
328a79cc
...
...
@@ -80,7 +80,7 @@ class SplitWMongoCourseBoostrapper(unittest.TestCase):
"""
split_db
=
self
.
split_mongo
.
db
# old_mongo doesn't give a db attr, but all of the dbs are the same
split_db
.
drop_collection
(
self
.
draft_mongo
.
collection
)
split_db
.
drop_collection
(
self
.
draft_mongo
.
collection
.
proxied_object
)
def
_create_item
(
self
,
category
,
name
,
data
,
metadata
,
parent_category
,
parent_name
,
draft
=
True
,
split
=
True
):
"""
...
...
requirements/edx/github.txt
View file @
328a79cc
...
...
@@ -11,6 +11,7 @@
-e git+https://github.com/edx/django-pipeline.git@88ec8a011e481918fdc9d2682d4017c835acd8be#egg=django-pipeline
-e git+https://github.com/edx/django-wiki.git@cd0b2b31997afccde519fe5b3365e61a9edb143f#egg=django-wiki
-e git+https://github.com/edx/django-oauth2-provider.git@0.2.7-fork-edx-2#egg=django-oauth2-provider
-e git+https://github.com/edx/MongoDBProxy.git@efe14679c9263ab491916ed960f5930127e05faf#egg=mongodb_proxy
-e git+https://github.com/gabrielfalcao/lettuce.git@cccc3978ad2df82a78b6f9648fe2e9baddd22f88#egg=lettuce
-e git+https://github.com/dementrock/pystache_custom.git@776973740bdaad83a3b029f96e415a7d1e8bec2f#egg=pystache_custom-dev
-e git+https://github.com/eventbrite/zendesk.git@d53fe0e81b623f084e91776bcf6369f8b7b63879#egg=zendesk
...
...
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