Skip to content

Commit

Permalink
fix: [ACI-901] use customized openedx-events package to prevent CI fa…
Browse files Browse the repository at this point in the history
…ilures (#2535)

* ci: [ACI-901] change standard events to cuztomized to prevent ci failing

* fix: [ACI-901] few fixes for ci

* refactor: [ACI-901] refactor code to pass ci checks

* style: [ACI-901] adjust style to pep8

---------

Co-authored-by: Andrii <[email protected]>
  • Loading branch information
andrii-hantkovskyi and Andrii authored Apr 10, 2024
1 parent 7b9f037 commit 598d1b5
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 27 deletions.
2 changes: 0 additions & 2 deletions cms/djangoapps/contentstore/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from lms.djangoapps.grades.api import task_compute_all_grades_for_course
from openedx.core.djangoapps.content.learning_sequences.api import key_supports_outlines
from openedx.core.djangoapps.discussions.tasks import update_discussions_settings_from_course_task
from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.lib.gating import api as gating_api
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import SignalHandler, modulestore
Expand Down Expand Up @@ -95,7 +94,6 @@ def create_catalog_data_for_signal(course_key: CourseKey) -> Optional[CourseCata
enrollment_start=course.enrollment_start,
enrollment_end=course.enrollment_end,
),
effort=CourseDetails.fetch_about_attribute(course_key, 'effort'),
hidden=course.catalog_visibility in ['about', 'none'] or course_key.deprecated,
invitation_only=course.invitation_only,
)
Expand Down
2 changes: 0 additions & 2 deletions cms/djangoapps/contentstore/signals/tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ def setUp(self):
end=None,
enrollment_start=None,
enrollment_end=None),
short_description=None,
effort=None,
hidden=False,
invitation_only=False
)
Expand Down
14 changes: 13 additions & 1 deletion cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@
# in the LMS and CMS.
# .. toggle_tickets: 'https://github.com/open-craft/edx-platform/pull/429'
'DISABLE_UNENROLLMENT': False,

# .. toggle_name: FEATURES['BADGES_ENABLED']
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Set to True to enable the Badges feature.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2024-04-10
'BADGES_ENABLED': False,
}

# .. toggle_name: ENABLE_COPPA_COMPLIANCE
Expand Down Expand Up @@ -2699,6 +2707,7 @@
EVENT_BUS_REDIS_CONNECTION_URL = "redis://:[email protected]:6379/"
EVENT_BUS_TOPIC_PREFIX = "dev"


def _should_send_learning_badge_events(settings):
return settings.FEATURES['BADGES_ENABLED']

Expand Down Expand Up @@ -2740,7 +2749,10 @@ def _should_send_learning_badge_events(settings):
"enabled",
)

# If the consumer encounters this many consecutive errors, exit with an error. This is intended to be used in a context where a management system (such as Kubernetes) will relaunch the consumer automatically.
# If the consumer encounters this many consecutive errors, exit with an error.
# This is intended to be used in a context where a management system (such as Kubernetes)
# will relaunch the consumer automatically.

#EVENT_BUS_REDIS_CONSUMER_CONSECUTIVE_ERRORS_LIMIT (defaults to None)

# How long the consumer should wait for new entries in a stream.
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/grades/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def course_grade_now_failed(user, course_id):
else:
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
status = CoursePassingStatusData.FAILING,
status=CoursePassingStatusData.FAILING,
user=UserData(
pii=UserPersonalData(
username=user.username,
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/grades/tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_persistent_grade_event_emitted(self):
)


class CoursePassingStatusEventsTest(SharedModuleStoreTestCase, OpenEdxEventsTestMixin):
class CoursePassingStatusEventsTest(SharedModuleStoreTestCase, OpenEdxEventsTestMixin): # pylint: disable=missing-class-docstring
ENABLED_OPENEDX_EVENTS = [
"org.openedx.learning.course.passing.status.updated.v1",
]
Expand Down Expand Up @@ -169,7 +169,7 @@ def test_course_passing_status_updated_emitted(self):
)


class CCXCoursePassingStatusEventsTest(
class CCXCoursePassingStatusEventsTest( # pylint: disable=missing-class-docstring
SharedModuleStoreTestCase, OpenEdxEventsTestMixin
):
ENABLED_OPENEDX_EVENTS = [
Expand Down
5 changes: 4 additions & 1 deletion lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5275,6 +5275,7 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
EVENT_BUS_REDIS_CONNECTION_URL = "redis://:[email protected]:6379/"
EVENT_BUS_TOPIC_PREFIX = "dev"


def _should_send_learning_badge_events(settings):
return settings.FEATURES['BADGES_ENABLED']

Expand Down Expand Up @@ -5316,7 +5317,9 @@ def _should_send_learning_badge_events(settings):
"enabled",
)

# If the consumer encounters this many consecutive errors, exit with an error. This is intended to be used in a context where a management system (such as Kubernetes) will relaunch the consumer automatically.
# If the consumer encounters this many consecutive errors, exit with an error.
# This is intended to be used in a context where a management system (such as Kubernetes)
# will relaunch the consumer automatically.
#EVENT_BUS_REDIS_CONSUMER_CONSECUTIVE_ERRORS_LIMIT (defaults to None)

# How long the consumer should wait for new entries in a stream.
Expand Down
2 changes: 1 addition & 1 deletion lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,4 +1087,4 @@ def get_env_setting(setting):
############## Event bus producer ##############
EVENT_BUS_PRODUCER_CONFIG = merge_producer_configs(
EVENT_BUS_PRODUCER_CONFIG, ENV_TOKENS.get("EVENT_BUS_PRODUCER_CONFIG", {})
)
)
2 changes: 1 addition & 1 deletion requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ pytz==2022.2.1

# openedx-events>0.13.0 causes test failures due to breaking changes
# These broken tests will be fixed in a separate PR
openedx-events==0.13.0
-e git+https://github.com/raccoongang/openedx-events[email protected]#egg=openedx_events
1 change: 0 additions & 1 deletion requirements/edx/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ nltk # Natural language processing; used by the c
nodeenv # Utility for managing Node.js environments; we use this for deployments and testing
oauthlib # OAuth specification support for authenticating via LTI or other Open edX services
openedx-calc # Library supporting mathematical calculations for Open edX
openedx-events>=0.12.0 # Open edX Events from Hooks Extension Framework (OEP-50)
openedx-filters # Open edX Filters from Hooks Extension Framework (OEP-50)
optimizely-sdk # Optimizely full stack SDK for Python
ora2>=4.5.0
Expand Down
7 changes: 2 additions & 5 deletions requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# via -r requirements/edx/github.in
-e git+https://github.com/openedx/xblock-google-drive.git@2d176468e33c0713c911b563f8f65f7cf232f5b6#egg=xblock-google-drive
# via -r requirements/edx/github.in
-e git+https://github.com/raccoongang/[email protected]#egg=openedx_events
# via -r requirements/edx/github.in
acid-xblock==0.2.1
# via -r requirements/edx/base.in
aiohttp==3.8.3
Expand Down Expand Up @@ -759,11 +761,6 @@ openedx-calc==3.0.1
# via -r requirements/edx/base.in
openedx-django-pyfs==3.2.1
# via xblock
openedx-events==0.13.0
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/base.in
# edx-event-bus-kafka
openedx-filters==0.8.0
# via
# -r requirements/edx/base.in
Expand Down
7 changes: 2 additions & 5 deletions requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# via -r requirements/edx/testing.txt
-e git+https://github.com/openedx/xblock-google-drive.git@2d176468e33c0713c911b563f8f65f7cf232f5b6#egg=xblock-google-drive
# via -r requirements/edx/testing.txt
-e git+https://github.com/raccoongang/[email protected]#egg=openedx_events
# via -r requirements/edx/testing.txt
acid-xblock==0.2.1
# via -r requirements/edx/testing.txt
aiohttp==3.8.3
Expand Down Expand Up @@ -991,11 +993,6 @@ openedx-django-pyfs==3.2.1
# via
# -r requirements/edx/testing.txt
# xblock
openedx-events==0.13.0
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/testing.txt
# edx-event-bus-kafka
openedx-filters==0.8.0
# via
# -r requirements/edx/testing.txt
Expand Down
7 changes: 2 additions & 5 deletions requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# via -r requirements/edx/base.txt
-e git+https://github.com/openedx/xblock-google-drive.git@2d176468e33c0713c911b563f8f65f7cf232f5b6#egg=xblock-google-drive
# via -r requirements/edx/base.txt
-e git+https://github.com/raccoongang/[email protected]#egg=openedx_events
# via -r requirements/edx/base.txtß
acid-xblock==0.2.1
# via -r requirements/edx/base.txt
aiohttp==3.8.3
Expand Down Expand Up @@ -942,11 +944,6 @@ openedx-django-pyfs==3.2.1
# via
# -r requirements/edx/base.txt
# xblock
openedx-events==0.13.0
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/base.txt
# edx-event-bus-kafka
openedx-filters==0.8.0
# via
# -r requirements/edx/base.txt
Expand Down

0 comments on commit 598d1b5

Please sign in to comment.