Issue to export a course

103 views
Skip to first unread message

Angel Ucan

unread,
Sep 6, 2018, 11:07:30 AM9/6/18
to General Open edX discussion
Hi
Good day
I hope you would help me.
I´m working on the CMS plataform. I´ve courses and when I try to use the tool to Export my course I have the next message: 
"Your library can not be exported to XML. There is not enough information to identify the component that failed. Check your library to identify any problems in components and try again. The crude error is: : command SON([('aggregate', u'fs.files'), ('pipeline', [{'$match': SON([('content_son.tag', 'c4x'), ('content_son.org', u'CONCAMIN'), ('content_son.course', u'CVIC01'), ('content_son.category', 'asset'), ('content_son.run', u'2018_S2')])}, {'$group': {'count': {'$sum': 1}, '_id': None, 'results': {'$push': '$$ROOT'}}}])]) on namespace edxapp.$cmd failed: The 'cursor' option is required, except for aggregate with the explain argument"
(see "BUG EXPORTAR.png").

In the Log file cms_default_1-stderr.log gives the following records:

[2018-09-05 15:21:36,243: INFO/MainProcess] Received task: contentstore.tasks.export_olx[d32bca4d-b7a7-464a-80a5-ce609dac0669]
[2018-09-05 15:21:41,520: ERROR/Worker-1] contentstore.tasks.export_olx[d32bca4d-b7a7-464a-80a5-ce609dac0669]: There was an error exporting course-v1:CONCAMIN+CVIC01+2018_S2
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/tasks.py", line 281, in create_export_tarball
    export_course_to_xml(modulestore(), contentstore(), course_module.id, root_dir, name)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/xml_exporter.py", line 346, in export_course_to_xml
    CourseExportManager(modulestore, contentstore, course_key, root_dir, course_dir).export()
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/xml_exporter.py", line 176, in export
    self.process_extra(root, courselike, root_courselike_dir, xml_centric_courselike_key, export_fs)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/xml_exporter.py", line 223, in process_extra
    root_courselike_dir + '/policies/assets.json',
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/contentstore/mongo.py", line 185, in export_all_for_course
    assets, __ = self.get_all_content_for_course(course_key)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/contentstore/mongo.py", line 209, in get_all_content_for_course
    course_key, start=start, maxresults=maxresults, get_thumbnails=False, sort=sort, filter_params=filter_params
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mongodb_proxy.py", line 53, in wrapper
    return func(*args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/contentstore/mongo.py", line 300, in _get_all_content_for_course
    items = self.fs_files.aggregate(pipeline_stages)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pymongo/collection.py", line 1819, in aggregate
    "aggregate", self.__name, **command_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pymongo/database.py", line 440, in _command
    msg, allowable_errors)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pymongo/helpers.py", line 213, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
OperationFailure: command SON([('aggregate', u'fs.files'), ('pipeline', [{'$match': SON([('content_son.tag', 'c4x'), ('content_son.org', u'CONCAMIN'), ('content_son.course', u'CVIC01'), ('content_son.category', 'asset'), ('content_son.run', u'2018_S2')])}, {'$group': {'count': {'$sum': 1}, '_id': None, 'results': {'$push': '$$ROOT'}}}])]) on namespace edxapp.$cmd failed: The 'cursor' option is required, except for aggregate with the explain argument

and on the DB  I made the following query
"SELECT task_output.text
FROM user_tasks_usertaskstatus AS user_task
JOIN user_tasks_usertaskartifact AS task_output
ON task_output.status_id=user_task.id
WHERE user_task.name LIKE '%CONCAMIN+CVIC01+2018_S2%' AND user_task.state='Failed';"

and the result is the following:

"{"raw_error_msg": "command SON([(''aggregate'', u''fs.files''), (''pipeline'', [{''$match'': SON([(''content_son.tag'', ''c4x''), (''content_son.org'', u''CONCAMIN''), (''content_son.course'', u''CVIC01''), (''content_son.category'', ''asset''), (''content_son.run'', u''2018_S2'')])}, {''$group'': {''count'': {''$sum'': 1}, ''_id'': None, ''results'': {''$push'': ''$$ROOT''}}}])]) on namespace edxapp.$cmd failed: The ''cursor'' option is required, except for aggregate with the explain argument"}"

somebody would help me? please

BUG EXPORTAR.png

Angel Ucan

unread,
Oct 2, 2018, 1:55:13 PM10/2/18
to General Open edX discussion
Problem:
The command aggregate for a collection needs a cursor option (mongodb 3.6 https://docs.mongodb.com/manual/reference/command/aggregate/#dbcmd.aggregate)

Solution:
Location: /edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/contentstore/mongo.py
function: get_all_content_for_course

change the next code:
        items = self.fs_files.aggregate(pipeline_stages)
        if items['result']:
            result = items['result'][0]
            count = result['count']
            assets = list(result['results'])
        else:
             no results
            count = 0
            assets = []
for this:
        count = 0
        assets = []
        items = self.fs_files.aggregate(pipeline_stages,cursor= {"batchSize": 0 })
        for result in items:
        count= result['count']
        assets=list(result['results'])
Reply all
Reply to author
Forward
0 new messages