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