Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove base_url from grades_download #999

Closed

Conversation

FahadKhalid210
Copy link

@FahadKhalid210 FahadKhalid210 commented Feb 6, 2024

Getting Error when click on Download profile information as a CSV.

Steps to reproduce:

  • Launch Tutor with Quince version and with minio plugin.

  • In the LMS, head to Data Downloads section under the Instrutor tab. Click the Download profile information as a CSV.

  • The download will fail and LMS logs will show below mentioned error


2024-02-06 15:13:50 2024-02-06 10:13:50,430 ERROR 673 [django.request] [user None] [ip None] log.py:241 - Internal Server Error: /courses/course-v1:edX+DemoX+Demo_Course/instructor/api/list_report_downloads
2024-02-06 15:13:50 Traceback (most recent call last):
2024-02-06 15:13:50   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
2024-02-06 15:13:50     response = get_response(request)
2024-02-06 15:13:50   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
2024-02-06 15:13:50     response = wrapped_callback(request, *callback_args, **callback_kwargs)
2024-02-06 15:13:50   File "/opt/pyenv/versions/3.8.18/lib/python3.8/contextlib.py", line 75, in inner
2024-02-06 15:13:50     return func(*args, **kwds)
2024-02-06 15:13:50   File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/http.py", line 43, in inner
2024-02-06 15:13:50     return func(request, *args, **kwargs)
2024-02-06 15:13:50   File "/openedx/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
2024-02-06 15:13:50     response = view_func(request, *args, **kwargs)
2024-02-06 15:13:50   File "/openedx/edx-platform/lms/djangoapps/instructor/views/api.py", line 2468, in list_report_downloads
2024-02-06 15:13:50     return _list_report_downloads(request=request, course_id=course_id)
2024-02-06 15:13:50   File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/cache.py", line 40, in _cache_controlled
2024-02-06 15:13:50     response = viewfunc(request, *args, **kw)
2024-02-06 15:13:50   File "/openedx/edx-platform/lms/djangoapps/instructor/views/api.py", line 227, in wrapped
2024-02-06 15:13:50     return func(*args, **kwargs)
2024-02-06 15:13:50   File "/openedx/edx-platform/lms/djangoapps/instructor/views/api.py", line 2480, in _list_report_downloads
2024-02-06 15:13:50     report_store = ReportStore.from_config(config_name='GRADES_DOWNLOAD')
2024-02-06 15:13:50   File "/openedx/edx-platform/lms/djangoapps/instructor_task/models.py", line 250, in from_config
2024-02-06 15:13:50     return DjangoStorageReportStore.from_config(config_name)
2024-02-06 15:13:50   File "/openedx/edx-platform/lms/djangoapps/instructor_task/models.py", line 287, in from_config
2024-02-06 15:13:50     return cls(
2024-02-06 15:13:50   File "/openedx/edx-platform/lms/djangoapps/instructor_task/models.py", line 270, in __init__
2024-02-06 15:13:50     self.storage = get_storage(storage_class, **storage_kwargs)
2024-02-06 15:13:50   File "/openedx/edx-platform/openedx/core/storage.py", line 114, in get_storage
2024-02-06 15:13:50     return get_storage_class(storage_class)(**kwargs)
2024-02-06 15:13:50   File "/openedx/venv/lib/python3.8/site-packages/storages/backends/s3.py", line 280, in __init__
2024-02-06 15:13:50     super().__init__(**settings)
2024-02-06 15:13:50   File "/openedx/venv/lib/python3.8/site-packages/storages/base.py", line 15, in __init__
2024-02-06 15:13:50     raise ImproperlyConfigured(
2024-02-06 15:13:50 django.core.exceptions.ImproperlyConfigured: Invalid setting 'base_url' for S3Storage

See the initial conversation here: hastexo/tutor-contrib-s3#70 (comment)

@FahadKhalid210 FahadKhalid210 requested a review from regisb February 6, 2024 10:31
Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Did you check if CSV profile information download still works without the minio plugin after the fix?

@@ -0,0 +1 @@
[Improvement] Remove base_url from GRADES_DOWNLOAD. (by @FahadKhalid210)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a bugfix; and we should not describe what we are doing in this commit, but why. The "what" is removing the base_url entry. The "why" is to prevent a 500 error caused by an ImproperlyConfigured exception when downloading profile information as CSV, and when the minio plugin is enabled.

So I would rewrite this changelog entry as follows:

- [Bugfix] When the minio plugin is enabled (particularly on Kubernetes), fix a 500 error on downloading profile information as CSV. (by @FahadKhalid210)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we run tutor without minio and this fix, it works fine.
But if we remove base_url and disable minio and click on Download Profile as a CSV then its available in Reports Available for Download but URL is not correct(missing grades in url) and got 404.

image image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so it would seem that we should not be pushing this fix in Tutor core, but in the minio plugin, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this fix pertains to the minio plugin, it would be more suitable to address it there. However, let me investigate if we can fix this url issue(404) in Tutor core.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@regisb URL issue is fixed by updating the location.
I have tested this fix with and without minio plugin and it works fine now.
URL without minio plugin:
http://local.overhang.io:8000/media/bb6d638a296059742509a0d319ddf8456b6dbf9a/edX_DemoX_Demo_Course_student_profile_info_2024-02-09-1101.csv

URL with minio plugin:
http://files.local.overhang.io:9000/openedx/openedx/media/bb6d638a296059742509a0d319ddf8456b6dbf9a/edX_DemoX_Demo_Course_student_profile_info_2024-02-09-1104.csv

@FahadKhalid210
Copy link
Author

Closing this as PR is created in minio plugin
overhangio/tutor-minio#35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Won't fix
Development

Successfully merging this pull request may close these issues.

2 participants