From e05d4a9c47b7839a9f65718a4b30fbf60b26573c Mon Sep 17 00:00:00 2001 From: Awais Jibran Date: Wed, 21 Apr 2021 11:56:54 +0500 Subject: [PATCH] Monitor error in NR when OLX validation fails. (#27381) --- cms/djangoapps/contentstore/tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index 46d21e5969..de2fd0b347 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -674,9 +674,10 @@ def validate_course_olx(courselike_key, course_dir, status): course_dir: complete path to the course olx status: UserTaskStatus object. """ - is_library = isinstance(courselike_key, LibraryLocator) olx_is_valid = True log_prefix = f'Course import {courselike_key}' + validation_failed_mesg = 'CourseOlx validation failed.' + is_library = isinstance(courselike_key, LibraryLocator) if is_library: return olx_is_valid @@ -698,13 +699,14 @@ def validate_course_olx(courselike_key, course_dir, status): if not has_errors: return olx_is_valid - LOGGER.error(f'{log_prefix}: CourseOlx validation failed.') + LOGGER.error(f'{log_prefix}: {validation_failed_mesg}') log_errors_to_artifact(errorstore, status) if bypass_olx_failure_enabled(): return olx_is_valid status.fail(UserErrors.OLX_VALIDATION_FAILED) + monitor_import_failure(courselike_key, status.state, message=validation_failed_mesg) return False