Skip to content

Conversation

@ormsbee
Copy link
Contributor

@ormsbee ormsbee commented Sep 30, 2022

Reverts #30715

Per @regisb:

FYI I believe that this PR causes the following issue when building the openedx Docker image on Tutor:
overhangio/tutor#726

@Agrendalath
Copy link
Member

@regisb, @ormsbee, I don't think this is the cause of this failure. I created this branch with local imports. Running tutor images build --no-cache openedx --build-arg EDX_PLATFORM_REPOSITORY=https://github.com/open-craft/edx-platform.git --build-arg EDX_PLATFORM_VERSION=agrendalath/bd-13-fix_imports4 gives me the following traceback:

Traceback (most recent call last):
  File "./manage.py", line 103, in <module>
    startup.run()
  File "/openedx/edx-platform/lms/startup.py", line 20, in run
    django.setup()
  File "/openedx/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "/opt/pyenv/versions/3.8.12/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/lms/djangoapps/bulk_email/models.py", line 22, in <module>
    from openedx.core.djangoapps.course_groups.cohorts import get_cohort_by_name
  File "/openedx/edx-platform/openedx/core/djangoapps/course_groups/cohorts.py", line 21, in <module>
    from lms.djangoapps.courseware import courses
  File "/openedx/edx-platform/lms/djangoapps/courseware/courses.py", line 62, in <module>
    from openedx.features.course_experience.utils import is_block_structure_complete_for_assignments
  File "/openedx/edx-platform/openedx/features/course_experience/utils.py", line 8, in <module>
    from lms.djangoapps.course_api.blocks.api import get_blocks
  File "/openedx/edx-platform/lms/djangoapps/course_api/blocks/api.py", line 10, in <module>
    from openedx.core.djangoapps.discussions.transformers import DiscussionsTopicLinkTransformer
  File "/openedx/edx-platform/openedx/core/djangoapps/discussions/transformers.py", line 6, in <module>
    from openedx.core.djangoapps.discussions.models import DiscussionTopicLink, DiscussionsConfiguration
  File "/openedx/edx-platform/openedx/core/djangoapps/discussions/models.py", line 309, in <module>
    class ProviderFilter(StackedConfigurationModel):
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 113, in __new__
    raise RuntimeError(
RuntimeError: Model class openedx.core.djangoapps.discussions.models.ProviderFilter doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

I also tried the branch from this PR (tutor images build --no-cache openedx --build-arg EDX_PLATFORM_REPOSITORY=https://github.com/openedx/edx-platform.git --build-arg EDX_PLATFORM_VERSION=revert-30715-agrendalath/bd-13-deprecate_course_id) and it results in the following Traceback:

Traceback (most recent call last):
  File "./manage.py", line 103, in <module>
    startup.run()
  File "/openedx/edx-platform/lms/startup.py", line 20, in run
    django.setup()
  File "/openedx/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "/opt/pyenv/versions/3.8.12/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/lms/djangoapps/bulk_email/models.py", line 22, in <module>
    from openedx.core.djangoapps.course_groups.cohorts import get_cohort_by_name
  File "/openedx/edx-platform/openedx/core/djangoapps/course_groups/cohorts.py", line 21, in <module>
    from lms.djangoapps.courseware import courses
  File "/openedx/edx-platform/lms/djangoapps/courseware/courses.py", line 52, in <module>
    from lms.djangoapps.courseware.module_render import get_module
  File "/openedx/edx-platform/lms/djangoapps/courseware/module_render.py", line 66, in <module>
    from lms.djangoapps.lms_xblock.runtime import LmsModuleSystem
  File "/openedx/edx-platform/lms/djangoapps/lms_xblock/runtime.py", line 20, in <module>
    from xmodule.library_tools import LibraryToolsService  # lint-amnesty, pylint: disable=wrong-import-order
  File "/openedx/edx-platform/xmodule/library_tools.py", line 13, in <module>
    from openedx.core.djangoapps.content_libraries import api as library_api
  File "/openedx/edx-platform/openedx/core/djangoapps/content_libraries/api.py", line 78, in <module>
    from openedx.core.djangoapps.content_libraries import permissions
  File "/openedx/edx-platform/openedx/core/djangoapps/content_libraries/permissions.py", line 7, in <module>
    from openedx.core.djangoapps.content_libraries.models import ContentLibraryPermission
  File "/openedx/edx-platform/openedx/core/djangoapps/content_libraries/models.py", line 81, in <module>
    class ContentLibrary(models.Model):
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 113, in __new__
    raise RuntimeError(
RuntimeError: Model class openedx.core.djangoapps.content_libraries.models.ContentLibrary doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

@regisb
Copy link
Contributor

regisb commented Oct 3, 2022

Thanks for taking the time to troubleshoot this issue @ormsbee @Agrendalath, I appreciate it. As @Agrendalath discovered, I was wrong in my diagnosis, and the change does not fix my issue. This PR can safely be closed. For more details see this comment: overhangio/tutor#726 (comment)

@ormsbee
Copy link
Contributor Author

ormsbee commented Oct 3, 2022

@Agrendalath did all the work. Thank you both for the great follow-up on this. Closing.

@ormsbee ormsbee closed this Oct 3, 2022
@nedbat nedbat deleted the revert-30715-agrendalath/bd-13-deprecate_course_id branch January 8, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants