Skip to content
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

Event logger config takes instance instead of class #7997

Merged
merged 10 commits into from
Aug 8, 2019

Conversation

DiggidyDave
Copy link
Contributor

@DiggidyDave DiggidyDave commented Aug 6, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

Deprecate EVENT_LOGGER assignment of class type in favor of instance. Deprecation is handled gracefully and only outputs a WARNING log message at config load time. We have a need to configure an impl of AbstractEventLogger which is instantiated/pre-configured with some proprietary dependencies.

This change is a small refactor on top of the nice change #7705 @dpgaspar made a few weeks ago.

TEST PLAN

Unit tests added, and tested manually.

ADDITIONAL INFORMATION

  • Has associated issue: 7705

REVIEWERS

@dpgaspar @john-bodley @graceguo-supercat @mistercrunch

@DiggidyDave
Copy link
Contributor Author

@betodealmeida

@DiggidyDave DiggidyDave changed the title Allow preconfigured event logger inst Event logger config takes instance instead of class Aug 6, 2019
@mistercrunch
Copy link
Member

@dpgaspar

Side note: Try running pre-commit from the root of the repo to autorun black and other commit hooks

@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 7, 2019
Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Nice! I have just a comment on using textwrap.dedent, and a few nits.

"""
result: Any = cfg_value
if inspect.isclass(cfg_value):
logging.getLogger().warning(
Copy link
Member

Choose a reason for hiding this comment

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

We could also use https://docs.python.org/3/library/exceptions.html#DeprecationWarning here. TBH I'm not super familiar with the difference or the best approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like this is probably a more "correct" approach, but I tried to use warnings.warn(msg, DeprecationWarning) and didn't see any message locally. I'm sure it can be configured, but I wanted to be sure that this would be seen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other than this one (which I am open to, but it seems... extra) I implemented all of your suggestions @betodealmeida

superset/utils/log.py Outdated Show resolved Hide resolved
superset/utils/log.py Outdated Show resolved Hide resolved
superset/utils/log.py Outdated Show resolved Hide resolved
@DiggidyDave
Copy link
Contributor Author

@dpgaspar one more ping

@betodealmeida betodealmeida merged commit 9233a63 into apache:master Aug 8, 2019
@DiggidyDave DiggidyDave deleted the allowPreconfiguredEventLoggerInst branch August 16, 2019 23:04
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants