GithubHelp home page GithubHelp logo

overhangio / tutor-discovery Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 41.0 166 KB

Course Discovery plugin for Tutor

License: GNU Affero General Public License v3.0

Python 69.55% Dockerfile 23.20% Makefile 7.25%

tutor-discovery's People

Contributors

angonz avatar armbouhali avatar bbrsofiane avatar cacciaresi avatar cmltawt0 avatar codewithemad avatar danyal-faheem avatar faraz32123 avatar gabor-boros avatar jramnai avatar kdmccormick avatar mafonso avatar michaelwheeler avatar navinkarkera avatar omarithawi avatar pcliupc avatar regisb avatar sodaling avatar ziafazal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tutor-discovery's Issues

TypeError at /jsi18n/

Accessing the /jsi18n/ url causes a 500 error, both in development and production:

http://discovery.local.overhang.io/jsi18n/
http://discovery.local.overhang.io:8381/jsi18n/

The stackstrace is attached.
TypeError at jsi18n.zip

discovery_1         | 2020-08-15 16:47:30,131 ERROR 11 [django.request] /openedx/venv/lib/python3.5/site-packages/django/utils/log.py:228 - Internal Server Error: /jsi18n/
discovery_1         | Traceback (most recent call last):
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
discovery_1         |     response = get_response(request)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response
discovery_1         |     response = self.process_exception_by_middleware(e, request)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response
discovery_1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
discovery_1         | TypeError: __init__() takes 1 positional argument but 2 were given
discovery_1         | 2020-08-15 16:47:30,131 ERROR 11 [django.request] /openedx/venv/lib/python3.5/site-packages/django/utils/log.py:228 - Internal Server Error: /jsi18n/
discovery_1         | Traceback (most recent call last):
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
discovery_1         |     response = get_response(request)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response
discovery_1         |     response = self.process_exception_by_middleware(e, request)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response
discovery_1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
discovery_1         | TypeError: __init__() takes 1 positional argument but 2 were given
discovery_1         | 2020-08-15 16:47:30,131 ERROR 11 [django.request] /openedx/venv/lib/python3.5/site-packages/django/utils/log.py:228 - Internal Server Error: /jsi18n/
discovery_1         | Traceback (most recent call last):
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
discovery_1         |     response = get_response(request)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response
discovery_1         |     response = self.process_exception_by_middleware(e, request)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response
discovery_1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
discovery_1         | TypeError: __init__() takes 1 positional argument but 2 were given

Error in README.rst on Debugging Instructions

The README.rst has an error. In the “Deubgging” section, the value for the ‘volumes’ directive in the docker-compose.override.yml file seems to be wrong. The folder structure within the docker container is /openedx/discovery. So, the course- prefix needs to be removed from the below configurations.

version: "3.7"
services:
discovery:
volumes:
- /path/to/course-discovery/:/openedx/course-discovery
discovery-assets:
volumes:
- /path/to/course-discovery/:/openedx/course-discovery

I will create a pull request for this.

using this plugin with "tutor dev init"

after installing and enabling this plugin and saving the config file:

pip install tutor-discovery
tutor plugins enable discovery
tutor config save

I issued the following command:

tutor dev init

and end up with this error:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=80): Max retries exceeded with url: /api/courses/v1/courses/?page=1&page_size=50&username=discovery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f60de487dc0>: Failed to establish a new connection: [Errno 111] Connection refused'))
CommandError: One or more of the data loaders above failed.
Error: Command failed with status 1: docker-compose -f /home/z/.local/share/tutor/env/local/docker-compose.yml -f /home/z/.local/share/tutor/env/dev/docker-compose.yml -f /home/z/.local/share/tutor/env/dev/docker-compose.tmp.yml --project-name tutor_dev -f /home/z/.local/share/tutor/env/local/docker-compose.jobs.yml -f /home/z/.local/share/tutor/env/dev/docker-compose.jobs.yml -f /home/z/.local/share/tutor/env/dev/docker-compose.jobs.tmp.yml run --rm discovery-job sh -e -c make migrate     

# Development partners                                                                                                                                               
./manage.py create_or_update_partner  \                                                                                                                              
  --site-id 1 \                                                                                                                                                      
  --site-domain discovery.local.overhang.io:8381 \                                                                                                                   
  --code dev --name "Open edX - development" \                                                                                                                       
  --lms-url="http://lms:8000" \                                                                                                                                      
  --studio-url="http://cms:8000" \                                                                                                                                   
  --courses-api-url "http://local.overhang.io:8000/api/courses/v1/" \                                                                                                
  --organizations-api-url "http://local.overhang.io:8000/api/organizations/v1/"                                                                                      

# Production partner                                                                                                                                                 
./manage.py create_or_update_partner  \                                                                                                                              
  --site-id 2 \                                                                                                                                                      
  --site-domain discovery.local.overhang.io \                                                                                                                        
  --code openedx --name "Open edX" \                                                                                                                                 
  --lms-url="http://lms:8000" \                                                                                                                                      
  --studio-url="http://cms:8000" \                                                                                                                                   
  --courses-api-url "http://local.overhang.io/api/courses/v1/" \                                                                                                     
  --organizations-api-url "http://local.overhang.io/api/organizations/v1/"                                                                                           

./manage.py refresh_course_metadata --partner_code=openedx                                                                                                           
./manage.py update_index --disable-change-limit

these urls: http://local.overhang.io/api/courses/v1/ and http://local.overhang.io/api/organizations/v1/,
are not valid in dev mode. I guess that this is a bug.

How can I export programs?

Hi,

I am wondering if there is a command/feature to export/import programs (akin to the one for export/import courses in openedx)?

Incorrect Partner API URLs in tutor local environment

The tutor local run discovery ./manage.py refresh_course_metadata command doesn't work with a default tutor local setup.

With a fresh install:

pip install -U tutor[full]
tutor plugins enable discovery
tutor config save
tutor local quickstart
tutor local importdemocourse
tutor local createuser --staff --superuser user [email protected]
tutor local run discovery ./manage.py createsuperuser
tutor local start
# log in to local.overhang.io/admin
# confirm can see response from http://local.overhang.io/api/courses/v1/courses/?page=1&page_size=50&username=discovery
# log into http://discovery.local.overhang.io/admin/
tutor local run discovery ./manage.py refresh_course_metadata # in other tab

The discovery container can't connect to the courses api:

2022-04-08 06:24:32,655 INFO 1 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:93 - Requesting course run page 1...
2022-04-08 06:24:32,658 INFO 1 [backoff] /openedx/venv/lib/python3.8/site-packages/backoff/_common.py:104 - Backing off _make_request(...) for 47.1s (requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=8000): Max retries exceeded with url: /api/courses/v1/courses/?page=1&page_size=50&username=discovery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5fd02fcb20>: Failed to establish a new connection: [Errno 111] Connection refused')))
2022-04-08 06:25:19,834 INFO 1 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:93 - Requesting course run page 1...
2022-04-08 06:25:19,841 INFO 1 [backoff] /openedx/venv/lib/python3.8/site-packages/backoff/_common.py:104 - Backing off _make_request(...) for 51.5s (requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=8000): Max retries exceeded with url: /api/courses/v1/courses/?page=1&page_size=50&username=discovery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5fd02f7ca0>: Failed to establish a new connection: [Errno 111] Connection refused')))
2022-04-08 06:26:11,318 INFO 1 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:93 - Requesting course run page 1...
2022-04-08 06:26:11,322 INFO 1 [backoff] /openedx/venv/lib/python3.8/site-packages/backoff/_common.py:104 - Backing off _make_request(...) for 26.8s (requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=8000): Max retries exceeded with url: /api/courses/v1/courses/?page=1&page_size=50&username=discovery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5fd02ee730>: Failed to establish a new connection: [Errno 111] Connection refused')))

The issue is caused by the partner api url setting pointing to local.overhang.io:8000 rather than local.overhang.io

I was able to resolve the issue with a simple change to the discovery init hook.

Pull request incoming...

k8s compatible

Hi, is this plugin already compatible with tutor k8s? Because I'm having same issue like #2 but in k8s and when looking in pypi.org page, it does not stated can be compatible with k8s.

Tutor : 3.6.2
tutor-discovery : 0.1.4

tutor-discovery codebase Python 3.12 upgrade

  • Ensure tutor-discovery codebase is compatible with Python 3.12
  • Update Python to 3.12 in Dockerfile for nightly and ensure the image builds as expected. The changes would be merged to nightly. his task would rely on upgrade of course-discovery to Python 3.12

See overhangio/tutor#1004 for the context.

ElasticSearch scheme hardcoded to "http"

Tutor core uses a different approach to generate the config for ElasticSearch where it honours the ELASTICSEARCH_SCHEME setting.

ELASTIC_SEARCH_CONFIG = [{
  {% if ELASTICSEARCH_SCHEME == "https" %}"use_ssl": True,{% endif %}
  "host": "{{ ELASTICSEARCH_HOST }}",
  "port": {{ ELASTICSEARCH_PORT }},
}]

https://github.com/overhangio/tutor/blob/master/tutor/templates/apps/openedx/settings/partials/common_all.py#L36-L41

The discovery plugin however assumes an hardcoded "http" scheme.

ELASTICSEARCH_DSL['default'].update({
    'hosts': "http://{{ ELASTICSEARCH_HOST }}:{{ ELASTICSEARCH_PORT }}/"
})

https://github.com/overhangio/tutor-discovery/blob/master/tutordiscovery/templates/discovery/apps/settings/partials/common.py#L23-L24

This has it's limitations when using an external Elasticsearch service, such as AWS ElasticSearch, where the configuration set for the core of Edx/tutor does not work with the discovery plugin.

Since the same ElasticSearch settings values are used for both services, a consistent configuration approach would be desired.

Media files not served by Discovery

Media files located at /openedx/discovery/course_discovery/media are not served. Any attempt to open <discovery host>/media/... returns 404 Not Found error, even if the file exists in the correct directory.

The problem seems to be that the media directory does not exists in /openedx/discovery/course_discovery/ in a fresh new container when uwsgi is launched. Then the --static-map /media=/openedx/discovery/course_discovery/media option does not create the mapping, even if the directory is created afterwards.

I have tested adding RUN mkdir course_discovery/media to the Dockerfile and it seems to fix the problem.

Getting 'Connection refused' error after running tutor local quickstart

Tutor: 10.4.1
Plugins:

discovery==10.1.7
ecommerce==10.1.6
lts==10.0.3 (disabled)
minio==10.1.3 (disabled)
notes==10.1.4 (disabled)
xqueue==10.1.2 (disabled)

I enabled the discovery plugin and after running tutor local quickstart it is erroring out here:

python manage.py install_es_indexes
2020-11-19 23:03:27,169 INFO 12 [course_discovery.apps.core.management.commands.install_es_indexes] /openedx/discovery/course_discovery/apps/core/management/commands/install_es_indexes.py:19 - Attempting to establish initial connection to Elasticsearch host [http://elasticsearch:9200]...
2020-11-19 23:03:27,171 INFO 12 [course_discovery.apps.core.management.commands.install_es_indexes] /openedx/discovery/course_discovery/apps/core/management/commands/install_es_indexes.py:21 - ...success!
2020-11-19 23:03:27,172 INFO 12 [course_discovery.apps.core.utils] /openedx/discovery/course_discovery/apps/core/utils.py:18 - Making sure alias [catalog] exists...
2020-11-19 23:03:27,175 INFO 12 [course_discovery.apps.core.utils] /openedx/discovery/course_discovery/apps/core/utils.py:22 - ...alias exists.
2020-11-19 23:03:28,994 INFO 17 [course_discovery.apps.core.management.commands.create_or_update_partner] /openedx/discovery/course_discovery/apps/core/management/commands/create_or_update_partner.py:127 - Partner updated with code dev
2020-11-19 23:03:30,786 INFO 22 [course_discovery.apps.core.management.commands.create_or_update_partner] /openedx/discovery/course_discovery/apps/core/management/commands/create_or_update_partner.py:127 - Partner updated with code openedx
2020-11-19 23:03:32,687 INFO 27 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /openedx/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:116 - Command is not using threads to write data.
2020-11-19 23:03:32,692 INFO 27 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /openedx/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:153 - Executing Loader [http://local.overhang.io/api/courses/v1/]
2020-11-19 23:03:33,507 INFO 27 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:34 - Refreshing Courses and CourseRuns from http://local.overhang.io/api/courses/v1/...
2020-11-19 23:03:33,508 INFO 27 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:84 - Requesting course run page 1...
2020-11-19 23:03:33,539 INFO 27 [backoff] /openedx/venv/lib/python3.5/site-packages/backoff/_common.py:86 - Backing off _make_request(...) for 60.0s (requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=80): Max retries exceeded with url: /api/courses/v1/courses/?page_size=50&username=discovery&page=1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4735de44a8>: Failed to establish a new connection: [Errno 111] Connection refused',)))
v2020-11-19 23:04:33,579 INFO 27 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:84 - Requesting course run page 1...
2020-11-19 23:04:33,583 INFO 27 [backoff] /openedx/venv/lib/python3.5/site-packages/backoff/_common.py:86 - Backing off _make_request(...) for 120.0s (requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=80): Max retries exceeded with url: /api/courses/v1/courses/?page_size=50&username=discovery&page=1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4735de46d8>: Failed to establish a new connection: [Errno 111] Connection refused',)))
2020-11-19 23:06:33,683 INFO 27 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:84 - Requesting course run page 1...
2020-11-19 23:06:33,698 INFO 27 [backoff] /openedx/venv/lib/python3.5/site-packages/backoff/_common.py:86 - Backing off _make_request(...) for 240.0s (requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=80): Max retries exceeded with url: /api/courses/v1/courses/?page_size=50&username=discovery&page=1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4735dca470>: Failed to establish a new connection: [Errno 111] Connection refused',)))
2020-11-19 23:10:33,792 INFO 27 [course_discovery.apps.course_metadata.data_loaders.api] /openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py:84 - Requesting course run page 1...
2020-11-19 23:10:33,797 ERROR 27 [backoff] /openedx/venv/lib/python3.5/site-packages/backoff/_common.py:101 - Giving up _make_request(...) after 4 tries (requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=80): Max retries exceeded with url: /api/courses/v1/courses/?page_size=50&username=discovery&page=1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4735de4a20>: Failed to establish a new connection: [Errno 111] Connection refused',)))
2020-11-19 23:10:33,797 ERROR 27 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /openedx/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:28 - CoursesApiDataLoader failed!

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1134, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1179, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1130, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 946, in _send_output
    self.send(msg)
  File "/usr/lib/python3.5/http/client.py", line 889, in send
    self.connect()
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f4735de4a20>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.5/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/openedx/venv/lib/python3.5/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='local.overhang.io', port=80): Max retries exceeded with url: /api/courses/v1/courses/?page_size=50&username=discovery&page=1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4735de4a20>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/openedx/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py", line 25, in execute_loader
    loader_class(*loader_args).ingest()
  File "/openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py", line 37, in ingest
    response = self._make_request(initial_page)
  File "/openedx/venv/lib/python3.5/site-packages/backoff/_sync.py", line 94, in retry
    ret = target(*args, **kwargs)
  File "/openedx/discovery/course_discovery/apps/course_metadata/data_loaders/api.py", line 86, in _make_request
    response = self.api_client.get(self.api_url + '/courses/', params=params)
  File "/openedx/venv/lib/python3.5/site-packages/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/openedx/venv/lib/python3.5/site-packages/edx_rest_api_client/client.py", line 283, in request
    return super(OAuthAPIClient, self).request(method, url, **kwargs)
  File "/openedx/venv/lib/python3.5/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/openedx/venv/lib/python3.5/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/openedx/venv/lib/python3.5/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='local.overhang.io', port=80): Max retries exceeded with url: /api/courses/v1/courses/?page_size=50&username=discovery&page=1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4735de4a20>: Failed to establish a new connection: [Errno 111] Connection refused',))

use LMS_BASE_URL instead of LMS_HOST

I recommend to use LMS_BASE_URL instead of LMS_HOST in this script and avoid hard coding the port number:
./tutordiscovery/templates/discovery/tasks/discovery/init

make migrate

# Development partners
./manage.py create_or_update_partner  \
  --site-id 1 \
  --site-domain {{ DISCOVERY_HOST }}:8381 \
  --code dev --name "Open edX - development" \
  --lms-url="http://lms:8000" \
  --studio-url="http://cms:8000" \
  --courses-api-url "http://{{ LMS_HOST }}:8000/api/courses/v1/" \
  --organizations-api-url "http://{{ LMS_HOST }}:8000/api/organizations/v1/"

# Production partner
./manage.py create_or_update_partner  \
  --site-id 2 \
  --site-domain {{ DISCOVERY_HOST }} \
  --code openedx --name "Open edX" \
  --lms-url="http://lms:8000" \
  --studio-url="http://cms:8000" \
  --courses-api-url "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/api/courses/v1/" \
  --organizations-api-url "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/api/organizations/v1/"

./manage.py refresh_course_metadata --partner_code=openedx
./manage.py update_index --disable-change-limit

Issue finishing a program whose all courses are finished

I've set up a single program to demonstrate this issue. I have a single course inside that program. My program type is honor. I have earned an Honor certificate for the single course inside my program, and I was expecting to complete the program. However, I only see
image

So as you can see, the certificate for the course is showing, but completion of this course does not count toward the completion of the program. I've went inside the code and figured out that after I cache the programs, the cached program's course's course run's type is always None. I do not understand why. So inside openedx/core/djangoapps/catalog/utils.py on line 121:
program = cache.get(PROGRAM_CACHE_KEY_TPL.format(uuid=uuid))

program is:

{
    'program-3883fdfa-a658-4a7c-a17a-fedb9d90dc07': {
        'uuid': '3883fdfa-a658-4a7c-a17a-fedb9d90dc07',
        'title': 'program1',
        'subtitle': '',
        'type': 'Honor',
        'type_attrs': {
            'uuid': '3f687c41-4319-4bb2-b5de-a03c22df7e49',
            'slug': 'honor',
            'coaching_supported': False
        },
        'status': 'active',
        'marketing_slug': 'program1',
        'marketing_url': 'honor/program1',
        'banner_image': {
            'large': {
                'url': 'http://discovery.local.overhang.io/media/media/programs/banner_images/3883fdfa-a658-4a7c-a17a-fedb9d90dc07-afa46d0d3bed.large.png',
                'width': 1440,
                'height': 480
            },
            'medium': {
                'url': 'http://discovery.local.overhang.io/media/media/programs/banner_images/3883fdfa-a658-4a7c-a17a-fedb9d90dc07-afa46d0d3bed.medium.png',
                'width': 726,
                'height': 242
            },
            'small': {
                'url': 'http://discovery.local.overhang.io/media/media/programs/banner_images/3883fdfa-a658-4a7c-a17a-fedb9d90dc07-afa46d0d3bed.small.png',
                'width': 435,
                'height': 145
            },
            'x-small': {
                'url': 'http://discovery.local.overhang.io/media/media/programs/banner_images/3883fdfa-a658-4a7c-a17a-fedb9d90dc07-afa46d0d3bed.x-small.png',
                'width': 348,
                'height': 116
            }
        },
        'hidden': False,
        'courses': [{
            'key': 'TestOrg+QP101',
            'uuid': '243897b4-356c-43c0-be72-9cc4c991f4c0',
            'title': 'Intro to quantum physics',
            'course_runs': [{
                'key': 'course-v1:TestOrg+QP101+2023_T2',
                'uuid': '41151902-5874-46bc-a71f-334fa2645403',
                'title': 'Intro to quantum physics',
                'external_key': None,
                'image': {
                    'src': 'http://local.overhang.io/asset-v1:TestOrg+QP101+2023_T2+type@asset+block@images_course_image.jpg',
                    'description': None,
                    'height': None,
                    'width': None
                },
                'short_description': None,
                'marketing_url': None,
                'seats': [],
                'start': '2023-01-01T00:00:00Z',
                'end': '2024-03-09T00:00:00Z',
                'go_live_date': None,
                'enrollment_start': None,
                'enrollment_end': None,
                'weeks_to_complete': None,
                'pacing_type': 'self_paced',
                'type': None,
                'run_type': '9dc9f0ca-3467-4cf7-aac6-fad8167a3c74',
                'status': 'published',
                'is_enrollable': True,
                'is_marketable': False,
                'availability': 'Current'
            }],
            'entitlements': [],
            'owners': [],
            'image': {
                'src': 'http://local.overhang.io/asset-v1:TestOrg+QP101+2023_T2+type@asset+block@images_course_image.jpg',
                'description': None,
                'height': None,
                'width': None
            },
            'short_description': None,
            'type': '9b5fe3b2-50e4-45bf-9dd5-0b290d61e8b4',
            'url_slug': None,
            'course_type': 'empty',
            'enterprise_subscription_inclusion': True,
            'excluded_from_seo': False,
            'excluded_from_search': False
        }],
        'authoring_organizations': [],
        'card_image_url': None,
        'is_program_eligible_for_one_click_purchase': False,
        'degree': None,
        'curricula': [],
        'marketing_hook': '',
        'total_hours_of_effort': None,
        'recent_enrollment_count': 0,
        'organization_short_code_override': '',
        'organization_logo_override_url': None,
        'primary_subject_override': None,
        'level_type_override': None,
        'language_override': None,
        'labels': [],
        'taxi_form': None,
        'program_duration_override': None,
        'data_modified_timestamp': '2023-12-28T08:51:21.520090Z',
        'excluded_from_search': False,
        'excluded_from_seo': False,
        'overview': '',
        'weeks_to_complete': None,
        'weeks_to_complete_min': None,
        'weeks_to_complete_max': None,
        'min_hours_effort_per_week': None,
        'max_hours_effort_per_week': None,
        'video': None,
        'expected_learning_items': [],
        'faq': [],
        'credit_backing_organizations': [],
        'corporate_endorsements': [],
        'job_outlook_items': [],
        'individual_endorsements': [],
        'languages': [],
        'transcript_languages': [],
        'subjects': [],
        'price_ranges': [],
        'staff': [],
        'credit_redemption_overview': '',
        'applicable_seat_types': ['audit', 'credit', 'professional', 'verified', 'honor'],
        'instructor_ordering': [],
        'enrollment_count': 0,
        'topics': [],
        'credit_value': 0,
        'enterprise_subscription_inclusion': False,
        'geolocation': None,
        'location_restriction': None,
        'is_2u_degree_program': False,
        'in_year_value': None,
        'skill_names': [],
        'skills': [],
        'product_source': {
            'name': 'sourcd1',
            'slug': 'sourcd1',
            'description': ''
        },
        'subscription_eligible': None,
        'subscription_prices': [],
        'pathway_ids': []
    }
}

I've looked at the discovery database and found something that didn't look right: all of the type_id's inside course_metadata_course_run table are set to 5, which is a course_type EMPTY, even though I selected honor. But even after manually changing this and re-caching, my problem wasn't solved. I also tried running refresh metadata but the issue persists.

Also, I managed to hard-code a solution only for understanding the underlying issue, maybe this will be helpful as well:

When I put the following code inside openedx/core/djangoapps/programs/utils.py on line 467

for course_run in course['course_runs']:
    course_run['type'] = CourseMode.HONOR

I get:
image

What could be the issue? Why is the course_run's type always None? How can I finish a program by finishing the courses inside it?|

I am using tutor to run openedx.
My discovery plugin version is: 16.0.0
My tutor version is: 16.1.7

Static assets not loading

I installed discovery following the instructions on the PyPI page

When I browsed to explore the api the static assets were 404ing.

Investigation revealed the nginx config (in /etc/nginx/conf.d/extra.conf on the nginx container) had the following line:

location /static {
    alias /var/www/ecommerce/assets/;
  }

but there was no ecommerce directory in that location. Instead the assets were inside a discovery directory.

The setting should instead be:

location /static {
    alias /var/www/discovery/assets;
  }

Note the removal of the trailing slash too.

I changed this in the file in tutor_root/env/apps/nginx/extra.conf and rebuilt the container and it worked as required.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.