fix: add additional logs to investigate import issue

This commit is contained in:
SaadYousaf
2022-02-02 13:12:53 +05:00
committed by Saad Yousaf
parent fb77ac9b27
commit 7a4ed05279
2 changed files with 16 additions and 0 deletions

View File

@@ -380,6 +380,8 @@ class XMLModuleStore(ModuleStoreReadBase):
monitor_import_failure(target_course_id, 'Updating', exception=exc)
raise exc
finally:
if str(target_course_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {target_course_id} : {course_descriptor}')
if course_descriptor is None:
pass
elif isinstance(course_descriptor, ErrorBlock):
@@ -487,6 +489,8 @@ class XMLModuleStore(ModuleStoreReadBase):
course_id = self.get_id(org, course, url_name)
if course_ids is not None and course_id not in course_ids:
if str(target_course_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {target_course_id} : Course ID not in Course IDs (List)')
return None
def get_policy(usage_id):
@@ -522,6 +526,8 @@ class XMLModuleStore(ModuleStoreReadBase):
course_descriptor = system.process_xml(etree.tostring(course_data, encoding='unicode'))
# If we fail to load the course, then skip the rest of the loading steps
if isinstance(course_descriptor, ErrorBlock):
if str(target_course_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {target_course_id} : Course Descriptor is instance of ErrorBlock')
return course_descriptor
self.content_importers(system, course_descriptor, course_dir, url_name)

View File

@@ -544,6 +544,8 @@ class ImportManager:
"""
Iterate over the given directories and yield courses.
"""
if str(self.target_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {self.target_id} : Starting run imports')
self.preflight()
for courselike_key in self.xml_module_store.modules.keys():
try:
@@ -558,12 +560,18 @@ class ImportManager:
# Import all static pieces.
self.import_static(data_path, dest_id)
if str(self.target_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {self.target_id} : Import Static Successful')
# Import asset metadata stored in XML.
self.import_asset_metadata(data_path, dest_id)
if str(self.target_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {self.target_id} : Import Asset Metadata Successful')
# Import all children
self.import_children(source_courselike, courselike, courselike_key, dest_id)
if str(self.target_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {self.target_id} : Import Children Successful')
# This bulk operation wraps all the operations to populate the draft branch with any items
# from the /drafts subdirectory.
@@ -574,6 +582,8 @@ class ImportManager:
# Import all draft items into the courselike.
courselike = self.import_drafts(courselike, courselike_key, data_path, dest_id)
if str(self.target_id) == 'course-v1:ArbiX+CS101+2014_T3':
logging.info(f'Investigation Log: {self.target_id} : Import Draft Successful')
yield courselike