export_all_courses not working

152 views
Skip to first unread message

Maarten de Waard

unread,
May 4, 2017, 10:24:10 AM5/4/17
to General Open edX discussion
Hi all,

I'm trying to export all courses, so I can have an automated backup of the courses my colleagues are making. I've tried running this on ficus.1 on a manually deployed live stack as well as on ficus.2 on the docker devstack:

    "source /edx/app/edxapp/edxapp_env && \                                      
     python /edx/app/edxapp/edx-platform/manage.py \                            
     cms --settings=devstack_docker export_all_courses /edx/app/courses/export/"



But this leads to

manage.py export_all_courses: error: unrecognized arguments: /edx/app/courses/export/

I tried fixing this problem like so:

class Command(BaseCommand):                                                        
   
"""                                                                        
    Export all courses from mongo to the specified data directory and list the courses which failed to export
    """
                                                                           
    help
= 'Export all courses from mongo to the specified data directory and list the courses which failed to export'
                                                                                   
   
def add_arguments(self, parser):                                              
        parser
.add_argument(                                                      
           
'output_path',                                                        
            type
=str,                                                              
            help
="output path for the course export")                              
                                                                                   
   
def handle(self, *args, **options):                                            
       
"""                                                                        
        Execute the command                                                        
        """
                                                                       
       
# if len(args) != 1:                                                      
       
#     raise CommandError("export requires maarten one argument: <output path>")
                                                                                   
        output_path
= options['output_path']                                      
        courses
, failed_export_courses = export_courses_to_output_path(output_path)
                                                                                   
       
print "=" * 80                                                            
       
print u"=" * 30 + u"> Export summary"                                      
       
print u"Total number of courses to export: {0}".format(len(courses))      
       
print u"Total number of courses which failed to export: {0}".format(len(failed_export_courses))
       
print u"List of export failed courses ids:"                                
       
print u"\n".join(failed_export_courses)                                    
       
print "=" * 80  

But now I have a new error!

Traceback (most recent call last):
 
File "/edx/app/edxapp/edx-platform/manage.py", line 116, in <module>
    execute_from_command_line
([sys.argv[0]] + django_args)
 
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility
.execute()
 
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
   
self.fetch_command(subcommand).run_from_argv(self.argv)
 
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
   
self.execute(*args, **cmd_options)
 
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output
= self.handle(*args, **options)
 
File "/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/management/commands/export_all_courses.py", line 30, in handle
    courses
, failed_export_courses = export_courses_to_output_path(output_path)
 
File "/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/management/commands/export_all_courses.py", line 48, in export_courses_to_output_path
    courses
= module_store.get_courses()
 
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mixed.py", line 90, in inner
    retval
= func(field_decorator=strip_key_collection, *args, **kwargs)
 
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mixed.py", line 322, in get_courses
    course_id
= self._clean_locator_for_mapping(course.id)
AttributeError: 'HiddenDescriptorWithMixins' object has no attribute 'id'




Any ideas? Did this work at some point and is it broken, or is it just me?

Maarten de Waard

unread,
May 16, 2017, 8:45:05 AM5/16/17
to General Open edX discussion
I fixed it in this pull request: https://github.com/edx/edx-platform/pull/15125
Reply all
Reply to author
Forward
0 new messages