Skip to content

Commit

Permalink
fix: [AXM-748] fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan authored and GlugovGrGlib committed Jun 19, 2024
1 parent 337ec80 commit d3a7f86
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openedx/features/offline_mode/assets_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def save_asset_file(temp_dir, xblock, path, filename):
content = read_static_file(static_path)
file_path = os.path.join(temp_dir, 'assets', filename)
except (FileNotFoundError, ItemNotFoundError, NotFoundError):
log.info(f"Asset not found: {filename}")
log.warning(f"Asset not found: {filename}, during offline content generation.")

else:
create_subdirectories_for_asset(file_path)
Expand Down
1 change: 0 additions & 1 deletion openedx/features/offline_mode/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def render_xblock_from_lms(self):
str(self.usage_key),
disable_staff_debug_info=True,
course=course,
will_recheck_access=False,
)

enable_completion_on_view_service = False
Expand Down
5 changes: 4 additions & 1 deletion openedx/features/offline_mode/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from celery import shared_task
from edx_django_utils.monitoring import set_code_owner_attribute
from django.http.response import Http404
from opaque_keys.edx.keys import CourseKey, UsageKey

from xmodule.modulestore.django import modulestore
Expand All @@ -17,6 +18,8 @@
def generate_offline_content_for_course(course_id):
"""
Generates offline content for all supported XBlocks in the course.
Blocks that are closed to responses won't be processed.
"""
course_key = CourseKey.from_string(course_id)
for offline_supported_block_type in OFFLINE_SUPPORTED_XBLOCKS:
Expand All @@ -28,7 +31,7 @@ def generate_offline_content_for_course(course_id):


@shared_task(
autoretry_for=(Exception,),
autoretry_for=(Exception, Http404),
retry_backoff=RETRY_BACKOFF_INITIAL_TIMEOUT,
retry_kwargs={'max_retries': MAX_RETRY_ATTEMPTS}
)
Expand Down
5 changes: 4 additions & 1 deletion openedx/features/offline_mode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def generate_offline_content(xblock, html_data):
save_xblock_html(tmp_dir, xblock, html_data)
create_zip_file(tmp_dir, base_path, f'{xblock.location.block_id}.zip')
except Http404:
log.error(f'Block {xblock.location.block_id} for course {xblock.location.course_key} not found.')
log.error(
f'Block {xblock.location.block_id} cannot be fetched from course'
f' {xblock.location.course_key} during offline content generation.'
)
finally:
shutil.rmtree(tmp_dir, ignore_errors=True)

Expand Down

0 comments on commit d3a7f86

Please sign in to comment.