From 7a4ed05279c449c3c4fa1e69f4627e437457f1ba Mon Sep 17 00:00:00 2001 From: SaadYousaf Date: Wed, 2 Feb 2022 13:12:53 +0500 Subject: [PATCH] fix: add additional logs to investigate import issue --- common/lib/xmodule/xmodule/modulestore/xml.py | 6 ++++++ common/lib/xmodule/xmodule/modulestore/xml_importer.py | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index c84c7be722..2756640ddd 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -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) diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py index 493e333bb4..2eba0782eb 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -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