@@ -484,6 +484,7 @@ def _copy_overrides(
484484 )
485485 store .update_item (dest_block , user_id )
486486
487+
487488class LibraryBackupTask (UserTask ): # pylint: disable=abstract-method
488489 """
489490 Base class for tasks related with Library backup functionality.
@@ -507,6 +508,7 @@ def generate_name(cls, arguments_dict) -> str:
507508 key = arguments_dict ['library_key_str' ]
508509 return f'Export of { key } '
509510
511+
510512@shared_task (base = LibraryBackupTask , bind = True )
511513# Note: The decorator @set_code_owner_attribute cannot be used here because the UserTaskMixin
512514# does stack inspection and can't handle additional decorators.
@@ -522,7 +524,7 @@ def backup_library(self, user_id: int, library_key_str: str) -> None:
522524 ensure_cms ("backup_library may only be executed in a CMS context" )
523525 set_code_owner_attribute_from_module (__name__ )
524526 library_key = LibraryLocatorV2 .from_string (library_key_str )
525-
527+
526528 try :
527529 self .status .set_state ('Exporting' )
528530 set_custom_attribute ("exporting_started" , str (library_key ))
@@ -541,4 +543,4 @@ def backup_library(self, user_id: int, library_key_str: str) -> None:
541543 TASK_LOGGER .exception ('Error exporting course %s' , library_key , exc_info = True )
542544 if self .status .state != UserTaskStatus .FAILED :
543545 self .status .fail ({'raw_error_msg' : str (exception )})
544- return
546+ return
0 commit comments