Unable to import Open edX Demo course in Redwood Release

Hey guys, I am currently testing out Redwood release of Open edX via Tutor k8s deployment, but I’m getting some issues. One of the issue I’m stuck with is importing course.

Importing Course:

Unable to import the Open edX Demo course: openedx-demo-course/dist/demo-course.tar.gz at master · openedx/openedx-demo-course · GitHub (Dont have any issue importing this to Palm Open edX deployment)
showing following error:


the logs in cms pod are just about import status like this:

GET /import_status/course-v1:Blend-ed+DMw-2+2024_123/new-demo-course.tar.gz => generated 171 bytes in 45 msecs (HTTP/1.1 200) 10 headers in 589 bytes (1 switches on core 0)

no errors showing there

I tried to first install the Open edX Demo Library and then import the course, still the same error

There is no issue with importing course without Randomized content.

Has anyone tried importing this demo course in Redwood release and facing similar issue?

Did you try from the console?

tutor local do import democourse

Oops, I totally forgot about that.

I tried the command, now got following error logs:

2024-07-19 16:11:15,362 INFO 24 [xmodule.modulestore.django] [user None] [ip None] django.py:220 - Sent course_published signal to <function update_course_apps at 0x7f2c9009b920> with kwargs {'course_key': CourseLocator('OpenedX', 'DemoX', 'DemoCourse', None, None)}. Response was: None
2024-07-19 16:11:15,362 INFO 24 [xmodule.modulestore.django] [user None] [ip None] django.py:220 - Sent course_published signal to <function update_discussions_on_course_publish at 0x7f2c90012de0> with kwargs {'course_key': CourseLocator('OpenedX', 'DemoX', 'DemoCourse', None, None)}. Response was: None
Traceback (most recent call last):
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 511, in depth_first
Importing...
    data_dir=../data, source_dirs=['/tmp/course/demo-course/course']
    Importing static content? True
    Importing python lib? True
    _update_and_import_block(
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 946, in _update_and_import_block
    store.publish(block.location, user_id)
  File "/openedx/edx-platform/xmodule/modulestore/mixed.py", line 90, in inner
    retval = func(field_decorator=strip_key_collection, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/edx-platform/xmodule/modulestore/mixed.py", line 992, in publish
    item = store.publish(location, user_id, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split_draft.py", line 375, in publish
    super().copy(
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 2333, in copy
    self._copy_subdag(
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 3155, in _copy_subdag
    self._copy_subdag(
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 3103, in _copy_subdag
    new_block = source_blocks[block_key]
                ~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: BlockKey(type='problem', id='0895f1b6c0b329e50b90')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/openedx/edx-platform/./manage.py", line 106, in <module>
    execute_from_command_line([sys.argv[0]] + django_args)
  File "/openedx/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/edx-platform/cms/djangoapps/contentstore/management/commands/import.py", line 66, in handle
    course_items = import_course_from_xml(
                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 804, in import_course_from_xml
    return list(manager.run_imports())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 574, in run_imports
    self.import_children(source_courselike, courselike, courselike_key, dest_id)
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 690, in import_children
    self.recursive_build(source_courselike, courselike, courselike_key, dest_id)
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 528, in recursive_build
    depth_first(source_courselike)
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 526, in depth_first
    depth_first(child)
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 526, in depth_first
    depth_first(child)
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 526, in depth_first
    depth_first(child)
  File "/openedx/edx-platform/xmodule/modulestore/xml_importer.py", line 524, in depth_first
    raise BlockFailedToImport(child.display_name, child.location)  # pylint: disable=raise-missing-from
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmodule.modulestore.xml_importer.BlockFailedToImport: Failed to import block: Randomized Content Block at location: i4x://OpenedX/DemoX/library_content/34a4d5e71d974c029cbde1956bd7c820

were you successfully able to import the course in Redwood release of Open edX?

I didn’t really try it, but the errors you get are strange, I will continue analyzing it and I’ll let you know if I import it.

I built the demo course, and it includes a reference to a library. The way that I think it was set up was the import command is supposed to import the library first so that when it imports the course, the library that it tries to refer to already exists.

Try this: Try to import the library .tar.gz first (as a library, not a course): openedx-demo-course/dist/demo-content-library.tar.gz at master · openedx/openedx-demo-course · GitHub

And then import the course as normal.

If that fixes your issue, great. It might mean the import process for Redwood needs to be adjusted a bit. I will try to give that a check too.

Hi @john_curricume, As mentioned here

I have already tried doing the following:

  1. From the studio: importing the demo content library (openedx-demo-course/dist/demo-content-library.tar.gz at master · openedx/openedx-demo-course · GitHub) and then importing the demo course (openedx-demo-course/dist/demo-course.tar.gz at master · openedx/openedx-demo-course · GitHub) using the tar files
  2. using tutor k8s command:
tutor k8s do importdemolibraries admin
tutor k8s do importdemocourse

Still the same issue.

After some more troubleshooting, I found that the issue was with my MongoDB server. In the current k8s setup, we were using our own MongoDB and MySQL servers. The MongoDB server was running the latest version, 7.0.12, which seemed to have caused the issue.
When I tried running the platform with the default tutor configuration of MongoDB, which used the MongoDB 7.0.7 docker image, everything worked properly.
So, I downgraded my MongoDB server to 7.0.7, and now there is no error while importing the demo course (even without importing the library first).

But I still don’t understand how this small version change can cause this error, as it’s all within version 7 of MongoDB.

2 Likes