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

chore: use os.getenv to simplify superset_config.py #25016

Merged

Conversation

sebastianliebscher
Copy link
Contributor

@sebastianliebscher sebastianliebscher commented Aug 17, 2023

SUMMARY

This PR removes a function in superset_config.py and replaces it by built-in os.getenv(). Instead of raising an exception when the env variable is missing, they now have a default value. Their default values are the same as in .env file (same values as in .env-non-dev)

TESTING INSTRUCTIONS

Changes in superset_config.py only affect docker deployments, so in order to test this PR run docker-compose up and check variables values.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@sebastianliebscher sebastianliebscher marked this pull request as draft August 17, 2023 15:51
@john-bodley john-bodley self-requested a review August 17, 2023 16:53
@sebastianliebscher sebastianliebscher marked this pull request as ready for review August 17, 2023 17:55
@sebastianliebscher
Copy link
Contributor Author

Python Misc / pre-commit is failing with

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

docker/pythonpath_dev/superset_config.py:38: error: Name "get_env_variable" is not defined  [name-defined]
docker/pythonpath_dev/superset_config.py:39: error: Name "get_env_variable" is not defined  [name-defined]
docker/pythonpath_dev/superset_config.py:40: error: Name "get_env_variable" is not defined  [name-defined]
docker/pythonpath_dev/superset_config.py:41: error: Name "get_env_variable" is not defined  [name-defined]
docker/pythonpath_dev/superset_config.py:42: error: Name "get_env_variable" is not defined  [name-defined]

This is the function I removed with this PR. Locally, all pre-commit checks run successfully.

@sebastianliebscher
Copy link
Contributor Author

Ah, OK. There are new variables from a new commit in master.

@john-bodley
Copy link
Member

@sebastianliebscher would you mind describing where the defaults are coming from via either updating your PR description or adding inline review comments?

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM

@michael-s-molina michael-s-molina merged commit 969cd66 into apache:master Aug 21, 2023
26 checks passed
@sebastianliebscher sebastianliebscher deleted the superset_config_simple branch August 21, 2023 13:24
@john-bodley
Copy link
Member

@sebastianliebscher I'm a tad confused. You linked to the .env-non-dev file which would indicate that now we have two places (as opposed to one) where the same defaults are defined and thus this doesn't seem to adhere to the DRY principle.

@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Aug 22, 2023
michael-s-molina pushed a commit that referenced this pull request Aug 23, 2023
@sebastianliebscher
Copy link
Contributor Author

Since I have only now come to it: For completeness @john-bodley's concerns were resolved in #25055.

@mistercrunch mistercrunch added 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 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/M v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants