-
Notifications
You must be signed in to change notification settings - Fork 0
Added logs while importing course #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
70010b8
f06453a
4f7eb6a
b4f312a
1591b5b
b023a33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,18 @@ 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 | ||
| ) | ||
| except Exception: # pylint: disable=broad-except | ||
| LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated') | ||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this changed?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added "as e" after Exception to print it. Awais bhai told me LOGGER.Exception prints exception. Restored old code. |
||
| LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated' + str(e)) | ||
|
||
| return olx_is_valid | ||
|
|
||
| has_errors = errorstore.return_error(ErrorLevel.ERROR.value) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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__', '') | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is required.