Commit d815d50a by Victor Shnayder

Remove obsolete eager flag for xml modulestore

* has to be eager
parent 484735bf
...@@ -10,7 +10,7 @@ class TestXMLModuleStore(object): ...@@ -10,7 +10,7 @@ class TestXMLModuleStore(object):
"""Make sure that path_to_location works properly""" """Make sure that path_to_location works properly"""
print "Starting import" print "Starting import"
modulestore = XMLModuleStore(DATA_DIR, eager=True, course_dirs=['toy', 'simple']) modulestore = XMLModuleStore(DATA_DIR, course_dirs=['toy', 'simple'])
print "finished import" print "finished import"
check_path_to_location(modulestore) check_path_to_location(modulestore)
...@@ -195,8 +195,7 @@ class XMLModuleStore(ModuleStoreBase): ...@@ -195,8 +195,7 @@ class XMLModuleStore(ModuleStoreBase):
""" """
An XML backed ModuleStore An XML backed ModuleStore
""" """
def __init__(self, data_dir, default_class=None, eager=False, def __init__(self, data_dir, default_class=None, course_dirs=None):
course_dirs=None):
""" """
Initialize an XMLModuleStore from data_dir Initialize an XMLModuleStore from data_dir
...@@ -205,15 +204,11 @@ class XMLModuleStore(ModuleStoreBase): ...@@ -205,15 +204,11 @@ class XMLModuleStore(ModuleStoreBase):
default_class: dot-separated string defining the default descriptor default_class: dot-separated string defining the default descriptor
class to use if none is specified in entry_points class to use if none is specified in entry_points
eager: If true, load the modules children immediately to force the
entire course tree to be parsed
course_dirs: If specified, the list of course_dirs to load. Otherwise, course_dirs: If specified, the list of course_dirs to load. Otherwise,
load all course dirs load all course dirs
""" """
ModuleStoreBase.__init__(self) ModuleStoreBase.__init__(self)
self.eager = eager
self.data_dir = path(data_dir) self.data_dir = path(data_dir)
self.modules = defaultdict(dict) # course_id -> dict(location -> XModuleDescriptor) self.modules = defaultdict(dict) # course_id -> dict(location -> XModuleDescriptor)
self.courses = {} # course_dir -> XModuleDescriptor for the course self.courses = {} # course_dir -> XModuleDescriptor for the course
...@@ -226,11 +221,6 @@ class XMLModuleStore(ModuleStoreBase): ...@@ -226,11 +221,6 @@ class XMLModuleStore(ModuleStoreBase):
class_ = getattr(import_module(module_path), class_name) class_ = getattr(import_module(module_path), class_name)
self.default_class = class_ self.default_class = class_
# TODO (cpennington): We need a better way of selecting specific sets of
# debug messages to enable. These were drowning out important messages
#log.debug('XMLModuleStore: eager=%s, data_dir = %s' % (eager, self.data_dir))
#log.debug('default_class = %s' % self.default_class)
self.parent_tracker = ParentTracker() self.parent_tracker = ParentTracker()
# If we are specifically asked for missing courses, that should # If we are specifically asked for missing courses, that should
......
...@@ -6,7 +6,7 @@ from .exceptions import DuplicateItemError ...@@ -6,7 +6,7 @@ from .exceptions import DuplicateItemError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def import_from_xml(store, data_dir, course_dirs=None, eager=True, def import_from_xml(store, data_dir, course_dirs=None,
default_class='xmodule.raw_module.RawDescriptor'): default_class='xmodule.raw_module.RawDescriptor'):
""" """
Import the specified xml data_dir into the "store" modulestore, Import the specified xml data_dir into the "store" modulestore,
...@@ -19,7 +19,6 @@ def import_from_xml(store, data_dir, course_dirs=None, eager=True, ...@@ -19,7 +19,6 @@ def import_from_xml(store, data_dir, course_dirs=None, eager=True,
module_store = XMLModuleStore( module_store = XMLModuleStore(
data_dir, data_dir,
default_class=default_class, default_class=default_class,
eager=eager,
course_dirs=course_dirs course_dirs=course_dirs
) )
for course_id in module_store.modules.keys(): for course_id in module_store.modules.keys():
......
...@@ -49,7 +49,7 @@ class RoundTripTestCase(unittest.TestCase): ...@@ -49,7 +49,7 @@ class RoundTripTestCase(unittest.TestCase):
copytree(data_dir / course_dir, root_dir / course_dir) copytree(data_dir / course_dir, root_dir / course_dir)
print "Starting import" print "Starting import"
initial_import = XMLModuleStore(root_dir, eager=True, course_dirs=[course_dir]) initial_import = XMLModuleStore(root_dir, course_dirs=[course_dir])
courses = initial_import.get_courses() courses = initial_import.get_courses()
self.assertEquals(len(courses), 1) self.assertEquals(len(courses), 1)
...@@ -66,7 +66,7 @@ class RoundTripTestCase(unittest.TestCase): ...@@ -66,7 +66,7 @@ class RoundTripTestCase(unittest.TestCase):
course_xml.write(xml) course_xml.write(xml)
print "Starting second import" print "Starting second import"
second_import = XMLModuleStore(root_dir, eager=True, course_dirs=[course_dir]) second_import = XMLModuleStore(root_dir, course_dirs=[course_dir])
courses2 = second_import.get_courses() courses2 = second_import.get_courses()
self.assertEquals(len(courses2), 1) self.assertEquals(len(courses2), 1)
......
...@@ -193,7 +193,7 @@ class ImportTestCase(unittest.TestCase): ...@@ -193,7 +193,7 @@ class ImportTestCase(unittest.TestCase):
"""Make sure that metadata is inherited properly""" """Make sure that metadata is inherited properly"""
print "Starting import" print "Starting import"
initial_import = XMLModuleStore(DATA_DIR, eager=True, course_dirs=['toy']) initial_import = XMLModuleStore(DATA_DIR, course_dirs=['toy'])
courses = initial_import.get_courses() courses = initial_import.get_courses()
self.assertEquals(len(courses), 1) self.assertEquals(len(courses), 1)
...@@ -216,7 +216,7 @@ class ImportTestCase(unittest.TestCase): ...@@ -216,7 +216,7 @@ class ImportTestCase(unittest.TestCase):
def get_course(name): def get_course(name):
print "Importing {0}".format(name) print "Importing {0}".format(name)
modulestore = XMLModuleStore(DATA_DIR, eager=True, course_dirs=[name]) modulestore = XMLModuleStore(DATA_DIR, course_dirs=[name])
courses = modulestore.get_courses() courses = modulestore.get_courses()
self.assertEquals(len(courses), 1) self.assertEquals(len(courses), 1)
return courses[0] return courses[0]
...@@ -245,7 +245,7 @@ class ImportTestCase(unittest.TestCase): ...@@ -245,7 +245,7 @@ class ImportTestCase(unittest.TestCase):
happen--locations should uniquely name definitions. But in happen--locations should uniquely name definitions. But in
our imperfect XML world, it can (and likely will) happen.""" our imperfect XML world, it can (and likely will) happen."""
modulestore = XMLModuleStore(DATA_DIR, eager=True, course_dirs=['toy', 'two_toys']) modulestore = XMLModuleStore(DATA_DIR, course_dirs=['toy', 'two_toys'])
toy_id = "edX/toy/2012_Fall" toy_id = "edX/toy/2012_Fall"
two_toy_id = "edX/toy/TT_2012_Fall" two_toy_id = "edX/toy/TT_2012_Fall"
...@@ -261,7 +261,7 @@ class ImportTestCase(unittest.TestCase): ...@@ -261,7 +261,7 @@ class ImportTestCase(unittest.TestCase):
"""Ensure that colons in url_names convert to file paths properly""" """Ensure that colons in url_names convert to file paths properly"""
print "Starting import" print "Starting import"
modulestore = XMLModuleStore(DATA_DIR, eager=True, course_dirs=['toy']) modulestore = XMLModuleStore(DATA_DIR, course_dirs=['toy'])
courses = modulestore.get_courses() courses = modulestore.get_courses()
self.assertEquals(len(courses), 1) self.assertEquals(len(courses), 1)
......
...@@ -57,7 +57,6 @@ def import_with_checks(course_dir, verbose=True): ...@@ -57,7 +57,6 @@ def import_with_checks(course_dir, verbose=True):
# module. # module.
modulestore = XMLModuleStore(data_dir, modulestore = XMLModuleStore(data_dir,
default_class=None, default_class=None,
eager=True,
course_dirs=course_dirs) course_dirs=course_dirs)
def str_of_err(tpl): def str_of_err(tpl):
......
...@@ -23,7 +23,6 @@ def import_course(course_dir, verbose=True): ...@@ -23,7 +23,6 @@ def import_course(course_dir, verbose=True):
# module. # module.
modulestore = XMLModuleStore(data_dir, modulestore = XMLModuleStore(data_dir,
default_class=None, default_class=None,
eager=True,
course_dirs=course_dirs) course_dirs=course_dirs)
def str_of_err(tpl): def str_of_err(tpl):
......
...@@ -68,7 +68,6 @@ def xml_store_config(data_dir): ...@@ -68,7 +68,6 @@ def xml_store_config(data_dir):
'OPTIONS': { 'OPTIONS': {
'data_dir': data_dir, 'data_dir': data_dir,
'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'default_class': 'xmodule.hidden_module.HiddenDescriptor',
'eager': True,
} }
} }
} }
......
...@@ -43,7 +43,8 @@ def get_full_modules(): ...@@ -43,7 +43,8 @@ def get_full_modules():
class_path = settings.MODULESTORE['default']['ENGINE'] class_path = settings.MODULESTORE['default']['ENGINE']
module_path, _, class_name = class_path.rpartition('.') module_path, _, class_name = class_path.rpartition('.')
class_ = getattr(import_module(module_path), class_name) class_ = getattr(import_module(module_path), class_name)
modulestore = class_(**dict(settings.MODULESTORE['default']['OPTIONS'].items() + [('eager', True)])) # TODO (vshnayder): wth is this doing???
modulestore = class_(**dict(settings.MODULESTORE['default']['OPTIONS'].items()))
_FULLMODULES = modulestore.modules _FULLMODULES = modulestore.modules
return _FULLMODULES return _FULLMODULES
......
...@@ -219,7 +219,6 @@ MODULESTORE = { ...@@ -219,7 +219,6 @@ MODULESTORE = {
'OPTIONS': { 'OPTIONS': {
'data_dir': DATA_DIR, 'data_dir': DATA_DIR,
'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'default_class': 'xmodule.hidden_module.HiddenDescriptor',
'eager': True,
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment