-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat: use event producer config #33269
Conversation
Replace openedx_event signal handlers with new producer config to push to event bus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
# in the LMS and CMS. | ||
# .. toggle_tickets: 'https://github.com/openedx/edx-platform/pull/31813' | ||
FEATURES['ENABLE_SEND_XBLOCK_EVENTS_OVER_BUS'] = True | ||
FEATURES['ENABLE_SEND_ENROLLMENT_EVENTS_OVER_BUS'] = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- What about other references to this? https://github.com/search?q=repo%3Aopenedx%2Fedx-platform%20ENABLE_SEND_ENROLLMENT_EVENTS_OVER_BUS&type=code ?
- Can you search for all four of these settings and ensure you got all occurrences in the repo?
""" | ||
Publish `CERTIFICATE_CREATED` events to the event bus. | ||
""" | ||
if SEND_CERTIFICATE_CREATED_SIGNAL.is_enabled(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could share the private PR for edx-internal settings so we can cross-reference that the old settings are being replaced by the new, and that they match values (enabled vs disabled)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Share it where? I don't think it makes sense to link it on a public PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't want to add private links here, maybe we just add more details to the deployment plan document?
@@ -440,78 +433,3 @@ def test_verified_to_audit(self): | |||
) as mock_allowlist_task: | |||
self.verified_enrollment.change_mode('audit') | |||
mock_allowlist_task.assert_not_called() | |||
|
|||
|
|||
class CertificateEventBusTests(ModuleStoreTestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocking question] I can't think of anything, but I'm wondering how we might ensure that people would know that a signal is in use by the event bus, and that it can't just be deleted or refactored? Maybe I should create a separate issue for this?
lms/envs/common.py
Outdated
# .. setting_default: {} | ||
# .. setting_description: Dictionary of event_types mapped to lists of dictionaries containing topic related configuration. | ||
# Each topic configuration dictionary contains | ||
# * a topic/stream name called `topic` where the event will be pushed to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think * topic: a topic/stream ...
would be a format that is quicker to read.
lms/envs/common.py
Outdated
# .. setting_description: Dictionary of event_types mapped to lists of dictionaries containing topic related configuration. | ||
# Each topic configuration dictionary contains | ||
# * a topic/stream name called `topic` where the event will be pushed to. | ||
# * a flag called `enabled` denoting whether the event will be published to the topic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can we use
toggle
instead offlag
? - Can we mention that each toggle should be annotated following: https://edx.readthedocs.io/projects/edx-toggles/en/latest/how_to/documenting_new_feature_toggles.html?
# Note: The topic names should not include environment prefix as it will be dynamically added based on | ||
# EVENT_BUS_TOPIC_PREFIX setting. | ||
EVENT_BUS_PRODUCER_CONFIG = { | ||
'org.openedx.learning.certificate.created.v1': [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add toggle annotations for each of these following: https://edx.readthedocs.io/projects/edx-toggles/en/latest/how_to/documenting_new_feature_toggles.html?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best I can think of is "temporary" but we also don't have a removal date, which is required. opt_in, maybe? or open_edx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems dependent on openedx/openedx-events#265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good questions.
- Because the toggle is a permanent feature of the config, let's not call it temporary.
- I think
opt_in
works fine. Note that these options should be going away anyway. - We have a strange situation where we will think we might be changing the default after some roll-out period, and this is dependent on the ticket you linked. Maybe just have some comment around this at the top of the config, noting that we need to work this out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking more I think we may still want to keep 'ENABLE_SEND_XBLOCK_EVENTS_OVER_BUS' since it actually gates several events which presumably should be launched or held back as a group. We can use the value of it to set the value in the config map. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beginning to wonder if the entire map should be derived, with different settings for each event, at least in edx-platform. It's not a perfect solution because of the proliferation of settings, but it I think it's better than having some of them be set in the map and some derived from elsewhere. Less risk of someone trying to only enable or disable one event and not realizing they need to recreate the entire rest of the map in settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone wants to add or change a topic it will still require setting the entire map, which is frustrating. But I think a better-than-before approach would just be to have enabled/disabled extracted as a different setting for each event and then derive the map from that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you concerned with a single topic, or the entire setting? We could also use KEYS_WITH_MERGED_VALUES.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire setting. If they wanted to change a single topic, they'd have to copy over the entire config dict and set all the derived settings correctly, which is non obvious. Keys with merged values looks like it may be our friend here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With keys with merged values, do you feel more comfortable using derived settings on a per-topic basis? Feel free to answer with actual code changes for where you are landing.
replaced by #33458 |
Left as draft because this should not be merged until Arch BOM is ready to test on stage.
Original PR description from @navinkarkera. This PR has all the changes of his PR here but events are disabled by default and the latest release of the openedx-events library is used. Got into some git troubles, hence the new PR.
Description
Replace openedx_event signal handlers with new producer config to push to event bus.
Supporting information
Testing instructions
make {lms,cms}-up
make cms-shell
pip install -r requirements/edx/development.txt
to install new openedx_events version.make cms-logs
.EVENT_BUS_PRODUCER_CONFIG
by toggling the flag and triggering the event.Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.