From 70010b854bd0f8bca560f054ab712ff5b97a1944 Mon Sep 17 00:00:00 2001 From: "adeel.tajamul" Date: Mon, 31 Jan 2022 17:29:31 +0500 Subject: [PATCH 1/6] Added logs while importing course --- cms/djangoapps/contentstore/tasks.py | 8 ++++++-- common/djangoapps/util/monitoring.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index f4c9c5d0d407..399f179f2cc3 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -526,9 +526,11 @@ def get_dir_for_filename(directory, filename): return if not user_has_access(user): + logging.info(f'Course import {course_key_string}: User is not allowed to import') return if not file_is_supported(): + logging.info(f'Course import {course_key_string}: File not supported') return is_library = isinstance(courselike_key, LibraryLocator) @@ -737,14 +739,16 @@ def validate_course_olx(courselike_key, course_dir, status): if not course_import_olx_validation_is_enabled(): return olx_is_valid try: + logging.info(log_prefix + "Validating. Calling olxcleaner.validate") __, errorstore, __ = olxcleaner.validate( filename=course_dir, steps=settings.COURSE_OLX_VALIDATION_STAGE, ignore=settings.COURSE_OLX_VALIDATION_IGNORE_LIST, allowed_xblocks=ALL_ALLOWED_XBLOCKS ) - except Exception: # pylint: disable=broad-except - LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated') + logging.info(log_prefix + "Course validated. No errors") + except Exception as e: # pylint: disable=broad-except + LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated' + str(e)) return olx_is_valid has_errors = errorstore.return_error(ErrorLevel.ERROR.value) diff --git a/common/djangoapps/util/monitoring.py b/common/djangoapps/util/monitoring.py index fa79e9f42925..6db214074d6e 100644 --- a/common/djangoapps/util/monitoring.py +++ b/common/djangoapps/util/monitoring.py @@ -13,9 +13,11 @@ def monitor_import_failure(course_key, import_step, message=None, exception=None """ set_custom_attribute('course_import_failure', import_step) set_custom_attributes_for_course_key(course_key) + logging.info(f"Course import failed at step {import_step} for course with key {course_key}") if message: set_custom_attribute('course_import_failure_message', message) + logging.info(f"Course import failed message {message}") if exception is not None: exception_module = getattr(exception, '__module__', '') From f06453ad21ff98b0ec66a21ae3d9221b1cd2235d Mon Sep 17 00:00:00 2001 From: "adeel.tajamul" Date: Tue, 1 Feb 2022 15:15:58 +0500 Subject: [PATCH 2/6] Added logs in import status handler --- cms/djangoapps/contentstore/tasks.py | 6 ++++-- cms/djangoapps/contentstore/views/import_export.py | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index 399f179f2cc3..ffacf5e360d4 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -739,14 +739,16 @@ def validate_course_olx(courselike_key, course_dir, status): if not course_import_olx_validation_is_enabled(): return olx_is_valid try: - logging.info(log_prefix + "Validating. Calling olxcleaner.validate") + if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": + logging.info(log_prefix + "Validating. Calling olxcleaner.validate") __, errorstore, __ = olxcleaner.validate( filename=course_dir, steps=settings.COURSE_OLX_VALIDATION_STAGE, ignore=settings.COURSE_OLX_VALIDATION_IGNORE_LIST, allowed_xblocks=ALL_ALLOWED_XBLOCKS ) - logging.info(log_prefix + "Course validated. No errors") + if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": + logging.info(log_prefix + "Course validated. No errors") except Exception as e: # pylint: disable=broad-except LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated' + str(e)) return olx_is_valid diff --git a/cms/djangoapps/contentstore/views/import_export.py b/cms/djangoapps/contentstore/views/import_export.py index b56d19d5950c..ff5a44e9ea3e 100644 --- a/cms/djangoapps/contentstore/views/import_export.py +++ b/cms/djangoapps/contentstore/views/import_export.py @@ -247,6 +247,9 @@ def import_status_handler(request, course_key_string, filename=None): 4 : Import successful """ + if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": + log.info(f"Import Status Handler {course_key_string}: Begin} ") + course_key = CourseKey.from_string(course_key_string) if not has_course_author_access(request.user, course_key): raise PermissionDenied() @@ -259,6 +262,8 @@ def import_status_handler(request, course_key_string, filename=None): for status_filter in STATUS_FILTERS: task_status = status_filter().filter_queryset(request, task_status, import_status_handler) task_status = task_status.order_by('-created').first() + if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": + log.info("Selected task status for course " + str(task_status.__dict__)) if task_status is None: # The task hasn't been initialized yet; did we store info in the session already? try: @@ -276,6 +281,9 @@ def import_status_handler(request, course_key_string, filename=None): else: status = min(task_status.completed_steps + 1, 3) + if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": + log.info("Status for course " + str(status)) + return JsonResponse({"ImportStatus": status, "Message": message}) From 4f7eb6a51dc25cffa0364f49e2e3b69772d2f8ac Mon Sep 17 00:00:00 2001 From: "adeel.tajamul" Date: Tue, 1 Feb 2022 15:42:07 +0500 Subject: [PATCH 3/6] Removed unrequired logs and added condition for test course --- cms/djangoapps/contentstore/tasks.py | 4 +--- cms/djangoapps/contentstore/views/import_export.py | 2 +- common/djangoapps/util/monitoring.py | 6 ++++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index ffacf5e360d4..05bd158ff7d2 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -526,11 +526,9 @@ def get_dir_for_filename(directory, filename): return if not user_has_access(user): - logging.info(f'Course import {course_key_string}: User is not allowed to import') return if not file_is_supported(): - logging.info(f'Course import {course_key_string}: File not supported') return is_library = isinstance(courselike_key, LibraryLocator) @@ -750,7 +748,7 @@ def validate_course_olx(courselike_key, course_dir, status): if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": logging.info(log_prefix + "Course validated. No errors") except Exception as e: # pylint: disable=broad-except - LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated' + str(e)) + LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated') return olx_is_valid has_errors = errorstore.return_error(ErrorLevel.ERROR.value) diff --git a/cms/djangoapps/contentstore/views/import_export.py b/cms/djangoapps/contentstore/views/import_export.py index ff5a44e9ea3e..03a1c94bdd09 100644 --- a/cms/djangoapps/contentstore/views/import_export.py +++ b/cms/djangoapps/contentstore/views/import_export.py @@ -248,7 +248,7 @@ def import_status_handler(request, course_key_string, filename=None): """ if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": - log.info(f"Import Status Handler {course_key_string}: Begin} ") + log.info(f"Import Status Handler {course_key_string}: Begin") course_key = CourseKey.from_string(course_key_string) if not has_course_author_access(request.user, course_key): diff --git a/common/djangoapps/util/monitoring.py b/common/djangoapps/util/monitoring.py index 6db214074d6e..9e061c56a598 100644 --- a/common/djangoapps/util/monitoring.py +++ b/common/djangoapps/util/monitoring.py @@ -13,11 +13,13 @@ def monitor_import_failure(course_key, import_step, message=None, exception=None """ set_custom_attribute('course_import_failure', import_step) set_custom_attributes_for_course_key(course_key) - logging.info(f"Course import failed at step {import_step} for course with key {course_key}") + if str(course_key) == "course-v1:ArbiX+CS101+2014_T3": + logging.info(f"Course import failed at step {import_step} for course with key {course_key}") if message: set_custom_attribute('course_import_failure_message', message) - logging.info(f"Course import failed message {message}") + if str(course_key) == "course-v1:ArbiX+CS101+2014_T3": + logging.info(f"Course import failed message {message}") if exception is not None: exception_module = getattr(exception, '__module__', '') From b4f312ad6773bfb75d6282fbaf97ff895d5c48d3 Mon Sep 17 00:00:00 2001 From: "adeel.tajamul" Date: Tue, 1 Feb 2022 17:06:32 +0500 Subject: [PATCH 4/6] Removed previous logs and added course conditional logs in common/lib/xmodule/xmodule/modulestore in files xml.py and xml_importer.py --- cms/djangoapps/contentstore/tasks.py | 4 ---- cms/djangoapps/contentstore/views/import_export.py | 8 -------- common/djangoapps/util/monitoring.py | 4 ---- common/lib/xmodule/xmodule/modulestore/xml.py | 7 ++++++- .../lib/xmodule/xmodule/modulestore/xml_importer.py | 11 +++++++++++ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index 05bd158ff7d2..8a7172c0abfd 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -737,16 +737,12 @@ def validate_course_olx(courselike_key, course_dir, status): if not course_import_olx_validation_is_enabled(): return olx_is_valid try: - if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": - logging.info(log_prefix + "Validating. Calling olxcleaner.validate") __, errorstore, __ = olxcleaner.validate( filename=course_dir, steps=settings.COURSE_OLX_VALIDATION_STAGE, ignore=settings.COURSE_OLX_VALIDATION_IGNORE_LIST, allowed_xblocks=ALL_ALLOWED_XBLOCKS ) - if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": - logging.info(log_prefix + "Course validated. No errors") except Exception as e: # pylint: disable=broad-except LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated') return olx_is_valid diff --git a/cms/djangoapps/contentstore/views/import_export.py b/cms/djangoapps/contentstore/views/import_export.py index 03a1c94bdd09..b56d19d5950c 100644 --- a/cms/djangoapps/contentstore/views/import_export.py +++ b/cms/djangoapps/contentstore/views/import_export.py @@ -247,9 +247,6 @@ def import_status_handler(request, course_key_string, filename=None): 4 : Import successful """ - if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": - log.info(f"Import Status Handler {course_key_string}: Begin") - course_key = CourseKey.from_string(course_key_string) if not has_course_author_access(request.user, course_key): raise PermissionDenied() @@ -262,8 +259,6 @@ def import_status_handler(request, course_key_string, filename=None): for status_filter in STATUS_FILTERS: task_status = status_filter().filter_queryset(request, task_status, import_status_handler) task_status = task_status.order_by('-created').first() - if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": - log.info("Selected task status for course " + str(task_status.__dict__)) if task_status is None: # The task hasn't been initialized yet; did we store info in the session already? try: @@ -281,9 +276,6 @@ def import_status_handler(request, course_key_string, filename=None): else: status = min(task_status.completed_steps + 1, 3) - if str(courselike_key) == "course-v1:ArbiX+CS101+2014_T3": - log.info("Status for course " + str(status)) - return JsonResponse({"ImportStatus": status, "Message": message}) diff --git a/common/djangoapps/util/monitoring.py b/common/djangoapps/util/monitoring.py index 9e061c56a598..fa79e9f42925 100644 --- a/common/djangoapps/util/monitoring.py +++ b/common/djangoapps/util/monitoring.py @@ -13,13 +13,9 @@ def monitor_import_failure(course_key, import_step, message=None, exception=None """ set_custom_attribute('course_import_failure', import_step) set_custom_attributes_for_course_key(course_key) - if str(course_key) == "course-v1:ArbiX+CS101+2014_T3": - logging.info(f"Course import failed at step {import_step} for course with key {course_key}") if message: set_custom_attribute('course_import_failure_message', message) - if str(course_key) == "course-v1:ArbiX+CS101+2014_T3": - logging.info(f"Course import failed message {message}") if exception is not None: exception_module = getattr(exception, '__module__', '') diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index c84c7be722ee..30a5bad53f0d 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -381,7 +381,8 @@ def try_load_course(self, course_dir, course_ids=None, target_course_id=None): raise exc finally: if course_descriptor is None: - pass + if str(target_course_id) == "course-v1:ArbiX+CS101+2014_T3": + logging.info("Course Descriptor is None") elif isinstance(course_descriptor, ErrorBlock): # Didn't load course. Instead, save the errors elsewhere. self.errored_courses[course_dir] = errorlog @@ -487,6 +488,8 @@ def load_course(self, course_dir, course_ids, tracker, target_course_id=None): 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("Course ID not in Course IDs (List)") return None def get_policy(usage_id): @@ -522,6 +525,8 @@ def get_policy(usage_id): 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("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 493e333bb407..bbe53bfdf796 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -544,6 +544,8 @@ def run_imports(self): """ Iterate over the given directories and yield courses. """ + if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3": + logging.info("Starting run imports") self.preflight() for courselike_key in self.xml_module_store.modules.keys(): try: @@ -558,12 +560,18 @@ def run_imports(self): # Import all static pieces. self.import_static(data_path, dest_id) + if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3": + logging.info("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("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("Import Children Successful") # This bulk operation wraps all the operations to populate the draft branch with any items # from the /drafts subdirectory. @@ -573,6 +581,9 @@ def run_imports(self): with self.store.bulk_operations(dest_id): # 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("Import Draft Successful") + yield courselike From 1591b5b6a1f21b69b1e2837cefd6e7251733e55d Mon Sep 17 00:00:00 2001 From: "adeel.tajamul" Date: Tue, 1 Feb 2022 17:25:29 +0500 Subject: [PATCH 5/6] Added f'Investigation Log : {course_id}' prefix to all conditional logs --- common/lib/xmodule/xmodule/modulestore/xml.py | 6 +++--- common/lib/xmodule/xmodule/modulestore/xml_importer.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index 30a5bad53f0d..4cead2ef0603 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -382,7 +382,7 @@ def try_load_course(self, course_dir, course_ids=None, target_course_id=None): finally: if course_descriptor is None: if str(target_course_id) == "course-v1:ArbiX+CS101+2014_T3": - logging.info("Course Descriptor is None") + logging.info(f"Investigation Log: {target_course_id} : Course Descriptor is None") elif isinstance(course_descriptor, ErrorBlock): # Didn't load course. Instead, save the errors elsewhere. self.errored_courses[course_dir] = errorlog @@ -489,7 +489,7 @@ def load_course(self, course_dir, course_ids, tracker, target_course_id=None): 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("Course ID not in Course IDs (List)") + logging.info(f"Investigation Log: {target_course_id} : Course ID not in Course IDs (List)") return None def get_policy(usage_id): @@ -526,7 +526,7 @@ def get_policy(usage_id): # 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("Course Descriptor is instance of ErrorBlock") + 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 bbe53bfdf796..dcf3c6940a0c 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -545,7 +545,7 @@ def run_imports(self): Iterate over the given directories and yield courses. """ if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3": - logging.info("Starting run imports") + logging.info(f"Investigation Log: {self.target_id} : Starting run imports") self.preflight() for courselike_key in self.xml_module_store.modules.keys(): try: @@ -561,17 +561,17 @@ def run_imports(self): # Import all static pieces. self.import_static(data_path, dest_id) if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3": - logging.info("Import Static Successful") + 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("Import Asset Metadata Successful") + 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("Import Children Successful") + 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. @@ -582,7 +582,7 @@ def run_imports(self): # 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("Import Draft Successful") + logging.info(f"Investigation Log: {self.target_id} : Import Draft Successful") yield courselike From b023a33527832420cbb400d9d42a70b7b64d1549 Mon Sep 17 00:00:00 2001 From: "adeel.tajamul" Date: Wed, 2 Feb 2022 07:27:57 +0500 Subject: [PATCH 6/6] Changed double quotes to single quote in logs --- common/lib/xmodule/xmodule/modulestore/xml.py | 13 ++++++------ .../xmodule/modulestore/xml_importer.py | 20 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index 4cead2ef0603..f040dd4f33b7 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -381,8 +381,7 @@ def try_load_course(self, course_dir, course_ids=None, target_course_id=None): raise exc finally: if course_descriptor is None: - if str(target_course_id) == "course-v1:ArbiX+CS101+2014_T3": - logging.info(f"Investigation Log: {target_course_id} : Course Descriptor is None") + pass elif isinstance(course_descriptor, ErrorBlock): # Didn't load course. Instead, save the errors elsewhere. self.errored_courses[course_dir] = errorlog @@ -391,6 +390,8 @@ def try_load_course(self, course_dir, course_ids=None, target_course_id=None): course_descriptor.parent = None course_id = self.id_from_descriptor(course_descriptor) self._course_errors[course_id] = errorlog + if str(target_course_id) == 'course-v1:ArbiX+CS101+2014_T3': + logging.info(f'Investigation Log: {target_course_id} : {course_descriptor}') def __str__(self): ''' @@ -488,8 +489,8 @@ def load_course(self, course_dir, course_ids, tracker, target_course_id=None): 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)") + 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): @@ -525,8 +526,8 @@ def get_policy(usage_id): 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") + 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 dcf3c6940a0c..1a01d1ee6a3c 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -544,8 +544,8 @@ def run_imports(self): """ 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") + 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: @@ -560,18 +560,18 @@ def run_imports(self): # 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") + 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") + 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") + 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. @@ -581,8 +581,8 @@ def run_imports(self): with self.store.bulk_operations(dest_id): # 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") + if str(self.target_id) == 'course-v1:ArbiX+CS101+2014_T3': + logging.info(f'Investigation Log: {self.target_id} : Import Draft Successful') yield courselike