Sunday, August 3, 2014

edx-platform - Strange error when generating certificates

I got this strange error when trying to generating certificates for all students in a course:

$: sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws ungenerated_certs -c UNS/Py_001/201405 --insecure 
                                       
2014-08-03 22:02:20,229 INFO 21338 [dd.dogapi] dog_stats_api.py:66 - Initializing dog api to use statsd: localhost, 8125
Fetching enrolled students for UNS/Py_001/201405
2014-08-03 22:02:21,494 ERROR 21338 [xmodule.x_module] x_module.py:265 - Unable to load item i4x://UNS/Py_001/vertical/8401ba9a15ee4da098ab580680e3d544, skipping
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 262, in get_children
    child = self.runtime.get_block(child_loc)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1041, in get_block
    return self.load_item(usage_id)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mongo/base.py", line 162, in load_item
    module = self.modulestore.get_item(location)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mongo/base.py", line 595, in get_item
    item = self._find_one(location)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mongo/base.py", line 553, in _find_one
    raise ItemNotFoundError(location)
ItemNotFoundError: i4x://UNS/Py_001/vertical/8401ba9a15ee4da098ab580680e3d544

2014-08-03 22:02:21,516 ERROR 21338 [xmodule.x_module] x_module.py:265 - Unable to load item i4x://UNS/Py_001/vertical/55e67a736ba24a7fa1ba4faf6a69a4c7, skipping
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 262, in get_children
    child = self.runtime.get_block(child_loc)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1041, in get_block
    return self.load_item(usage_id)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mongo/base.py", line 162, in load_item
    module = self.modulestore.get_item(location)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mongo/base.py", line 595, in get_item
    item = self._find_one(location)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mongo/base.py", line 553, in _find_one
    raise ItemNotFoundError(location)
ItemNotFoundError: i4x://UNS/Py_001/vertical/55e67a736ba24a7fa1ba4faf6a69a4c7

/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py:114: Warning: Column 'mode' cannot be null
  return self.cursor.execute(query, args)



According the error log, the pink error is related to the xmodule part of the stack. I posted a question in the edx-code mailing list and hoping someone will help me to figure out how to solve this: https://groups.google.com/d/msg/edx-code/cWuQc7T_SCA/r5vUFoiJ6OgJ

And the error in red color above is due to a lack of course mode declaration in the mysql database of the platform for the course. So, I went to the Django admin interface, Course Mode model and create a random mode for my course:

http://my.openedx.url/admin/course_modes/coursemode/

Then I ran the certificates generation command again. Everything's find now, but I still have to look into the code base to find out the reasons which caused this problem?

P/S: I'm still running the old version of the configuration repo (release-injera).