Skip to content

feat!: new event bus config format - #272

Merged
rgraber merged 24 commits into
mainfrom
rsgraber/20230926-update-publish-via-config
Oct 6, 2023
Merged

feat!: new event bus config format#272
rgraber merged 24 commits into
mainfrom
rsgraber/20230926-update-publish-via-config

Conversation

@rgraber

@rgraber rgraber commented Sep 26, 2023

Copy link
Copy Markdown
Contributor

Description:
Change the event bus producing config from

{
    "event_type": [
        {topic: topic_a, event_key_field: field, enabled: True/False},
	{topic: topic_b, event_key_field: field, enabled: True/False},
    ]
}

to

{
     "event_type": {
         "topic_a":
	    {event_key_field: field, enabled: True/False},
	 "topic_b":
	    {event_key_field: field, enabled: True/False}
     }
}

ISSUE: #210

Dependencies: Would block openedx/openedx-platform#33269

Reviewers:

  • tag reviewer
  • tag reviewer

Merge checklist:

  • All reviewers approved
  • CI build is green
  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are squashed

Post merge:

  • Create a tag
  • Check new version is pushed to PyPI after tag-triggered build is
    finished.
  • Delete working branch (if not needed anymore)

Author concerns: List any concerns about this PR - inelegant
solutions, hacks, quick-and-dirty implementations, concerns about
migrations, etc.

@rgraber
rgraber force-pushed the rsgraber/20230926-update-publish-via-config branch from f752ddc to d62ca05 Compare September 29, 2023 12:13

@robrap robrap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did not do a full review (yet?), but just noting that the ADR looks good. Thanks.

@navinkarkera: [question] Can we get away with the backward incompatible change? That would be simplest, but I didn't know if we needed temporary code that transforms, or the use of a new name for the setting etc. for your transition? Or is that all for named releases and will it be simple to transition with instructions?

Comment thread docs/decisions/0013-new-event-bus-producer-config.rst Outdated
@bmtcril

bmtcril commented Sep 29, 2023

Copy link
Copy Markdown
Contributor

This all makes sense to me. Since the original PR never landed on edx-platform I don't think there's any reason for any special shims or error handling for the transition.

@navinkarkera

Copy link
Copy Markdown
Contributor

@robrap The original PR(s) using this config have not been merged yet, the one in edx-platform as well as openedx/xblock-skill-tagging#14. So we can go ahead with the backward incompatible change and update the PR's based on the decision and changes here.

@navinkarkera navinkarkera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rgraber The ADR looks good to me. 👍

Comment thread docs/decisions/0013-new-event-bus-producer-config.rst Outdated

@robrap robrap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A left a bunch of mostly non-blocking suggestions. Also, any could be added as another iteration if we wish to improve and you want to land this more quickly.

Comment thread CHANGELOG.rst
Comment thread openedx_events/apps.py Outdated
Comment thread openedx_events/apps.py Outdated
Comment thread openedx_events/event_bus/__init__.py Outdated
Comment thread openedx_events/tests/test_producer_config.py Outdated
Comment thread test_utils/test_settings.py Outdated
Comment thread openedx_events/apps.py
raise ProducerConfigurationError(
event_type=event_type,
message="One of the configuration object is not a dictionary"
message="One of the configuration objects is not a dictionary"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Imagine everything is working fine, and someone adds a new bad config detail. Do we want that to break all working publishing? Seems scary. Something to consider.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. I'm going to punt on this since it requires a little more thought than I want to put it while trying to land this but it will be a fast follow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[punt]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't it better to fail early rather than allowing a back config detail? This error will stop the application from starting.

Comment thread openedx_events/event_bus/__init__.py Outdated
@rgraber
rgraber marked this pull request as ready for review October 5, 2023 12:41
@rgraber
rgraber requested a review from a team October 5, 2023 12:41

@robrap robrap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the changes.

Comment thread openedx_events/apps.py Outdated
Comment thread openedx_events/apps.py Outdated
Comment thread openedx_events/event_bus/__init__.py Outdated
Comment thread openedx_events/event_bus/__init__.py Outdated
Comment thread openedx_events/event_bus/__init__.py Outdated

@robrap robrap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it is close.

Comment thread openedx_events/event_bus/__init__.py Outdated
Comment thread docs/decisions/0014-new-event-bus-producer-config.rst Outdated
Comment thread docs/decisions/0014-new-event-bus-producer-config.rst Outdated

@robrap robrap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you.

@navinkarkera navinkarkera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rgraber This looks great. Feel free to ignore my suggestions if it doesn't make sense.

Comment thread openedx_events/apps.py
Comment on lines +25 to +26
for topic in event_type_producer_configs.keys():
if event_type_producer_configs[topic]["enabled"] is True:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
for topic in event_type_producer_configs.keys():
if event_type_producer_configs[topic]["enabled"] is True:
for topic, config in event_type_producer_configs.items():
if config["enabled"] is True:

Comment thread openedx_events/apps.py
topic=configuration["topic"],
event_key_field=configuration["event_key_field"],
topic=topic,
event_key_field=event_type_producer_configs[topic]["event_key_field"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
event_key_field=event_type_producer_configs[topic]["event_key_field"],
event_key_field=config["event_key_field"],

Comment thread openedx_events/apps.py
raise ProducerConfigurationError(
event_type=event_type,
message="One of the configuration object is not a dictionary"
message="One of the configuration objects is not a dictionary"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't it better to fail early rather than allowing a back config detail? This error will stop the application from starting.

get_producer.cache_clear()


def merge_producer_configs(producer_config_original, producer_config_overrides):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: renaming these variables to original and overrides would make it easier to understand as producer_config prefix should not be needed.

@rgraber
rgraber merged commit 6e7dbd2 into main Oct 6, 2023
@rgraber
rgraber deleted the rsgraber/20230926-update-publish-via-config branch October 6, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants