Conversation
Closed
katrinan029
reviewed
Aug 11, 2025
Contributor
|
Implementation looks good to me. Some minor details:
|
Contributor
Author
@katrinan029 10.4.0 is the right version where I added it, so this works fine after the branch has been rebased to include Hamzah's upgrade request that sets edx-enterprise's openedx-events version to 10.4.0 |
Contributor
Author
|
I manually tested this and can confirm: When lacking Kafka / Event Bus settings, this code will not produce an uncaught exception. Thus, we can merge this PR as-is without depending on external config. |
Contributor
Author
|
This is on the correct version of |
Contributor
Author
|
@katrinan029 Here's the video of the event working, and two screenshots for the contents of the event message. This requires some explanation:
Screen.Recording.2025-08-12.at.5.28.04.PM.mov
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
When an EnterpriseGroup gets deleted, we want to send a message to the Openedx Event Bus that is read by enterprise-access to delete the corresponding PolicyGroupAssociation.
Deployment instructions
When rolling this out with edx-platform, delete some enterprisegroup on stage to confirm there are no errors. The Event Bus signal will not be sent without the edx-internal config, but it's important that there's no error even without that config.
Links
Internal 2U ticket: https://2u-internal.atlassian.net/browse/ENT-10440
Dependencies
This depends on openedx/openedx-events#504
and on #2431, which is planned to be merged on August 11.
To Dos
Implemented in this PR as of 06/11/25:
Setup Instructions for Kafka for Enterprise Group Deleted Event
Follow this for testing and for local development. It's a number of steps, but if you follow this closely it should not be too hard to set up.
Reference Setup
Let's follow a reference setup to first ensure that Kafka is working properly on your
local machine. For this, set up enterprise-access and enterprise-subsidy repos. Their readmes
contain instructions on how to set up Kafka in docker.
Follow the instructions to run your kafka docker container, make sure that the Confluence control center is running on
localhost:9021/clusters/, and produce / consume the ping test event described in the readmes. Verify that the event shows up in the consumer logs and in the Confluence control center in thedev-enterprise-coretopic. (You need to open the topic page -> messages first and then emit the event afterwards in order to see it, as when you open the page / refresh it removes previous logs.)The docker container seems to not stay online indefinitely, it may have an auto-shutdown or something. So you may have to re-run
make dev.up.with-eventssometimes from the enterprise-subsidy and enterprise-access folders.Edx-Enterprise / LMS Config
edx-enterprise is a library installed in LMS. As such, to get Kafka to work, you need to configure it locally in LMS. So paste this code into your edx-platform/lms/envs/private.py (create if the file doesn't exist):
Install local libraries
To run your edx-enterprise consumer, LMS depends on edx_enterprise for the consumer code
and openedx_events for the event schema. So you need the code from both PRs locally.
/srcfolder if you haven't alreadymake lms-shellpip install -e /edx/src/edx-enterprisepip install openedx-events==10.4.0(or newer)You will also need to install two other libraries as dependencies into your lms-shell:
pip install edx-event-bus-kafkapip install pip install confluent-kafka[avro,schema-registry]Generate Avro schemas if necessary
Only necessary if you make changes to openedx-events:
If you're in the middle of development and have made any changes to the signals or data in
openedx-events, or added a new signal to openedx-events, you need to regenerate the avro schema by running thegenerate_avro_schemas <your-signal-name>management command that can be found in openedx-signals.Test Signals locally
localhost:9021/clusters/. If not, go to enterprise-access and enterprise-subsidy folders and just domake dev.up.with-eventsagain../manage.py lms produce_enterprise_ping_event.manage.py lms produce_event --signal openedx_events.enterprise.signals.ENTERPRISE_GROUP_DELETED --topic enterprise-core --key-field enterprise_group.uuid --data '{"enterprise_group": { "uuid": "d509a63b-eb11-4dc8-8b84-4688c7335110" }}'../manage.py lms produce_event_bus_group_delete_test_eventMerge checklist:
requirements/*.txtfiles)base.inif needed in production but edx-platform doesn't install ittest-master.inif edx-platform pins it, with a matching versionmake upgrade && make requirementshave been run to regenerate requirementsmake statichas been run to update webpack bundling if any static content was updated./manage.py makemigrationshas been run./manage.py lms makemigrationsin the shell.Post merge:
(so basically once your build finishes, after maybe a minute you should see the new version in PyPi automatically (on refresh))
make upgradein edx-platform will look for the latest version in PyPi.