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

Simplify Config #500

Merged
merged 45 commits into from
Nov 23, 2022
Merged

Simplify Config #500

merged 45 commits into from
Nov 23, 2022

Conversation

Bento007
Copy link
Contributor

@Bento007 Bento007 commented Oct 13, 2022

#119

Reviewers

Functional:

Readability:


Changes

  • Merge server_config and dataset_config into app_config. This adds more complexity than needed.
  • Validate app_config using pydantic. This greatly simplifies the config validation processes and uses existing python type hinting to do it.
  • modify AppConfig.__init__ to accept a file name as a parameter.
  • Remove external_config and secret_config. This added more complexity that we weren't really using. Pydnatic support this functionality and we can add it back in the future if needed.
  • Remove getting config from environment variables. This is part of removing the external config.
  • Remove the external section from config. This is part of removing the external config.
  • Rename the dataset config parameter to default_dataset. This is a better description of what it is.
  • Add dataroots config parameter where multiple dataroots can be specified. To simplify the requirement that dataroot can be both a string and dictionary, dataroots was added to contain the dictionary version of dataroot. This simplifies the configuration and validation logic and adds minimal overhead.
  • Rename s3: region_name config parameter to s3_region_name. This simplifies the config by reducing the nesting level for a single key dictionary.
  • Rename MatrixDataLoader to DataLoader. This was a TODO in the code.
  • Use current_app.app_config in the API handlers rather than passing app_config as a parameter. This reduces the complexity of the interface for some of the API handlers.
  • Remove per_dataset_config because it's not used and adds significant complexity.
  • Remove allowed_matrix_types because only CXG is supported.
  • Remove get_title and get_about from app_config. All it does is wrap the equivalent data_adapter function.
  • Remove obsolete tests.

Testing

Checked that it works on rdev


Future

  • Recommend moving documentation to the AppConfigModel.py
  • remove default_config.py

@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Merging #500 (4e33227) into main (fe66b71) will decrease coverage by 0.38%.
The diff coverage is 95.38%.

@@            Coverage Diff             @@
##             main     #500      +/-   ##
==========================================
- Coverage   78.32%   77.94%   -0.39%     
==========================================
  Files          91       84       -7     
  Lines        7059     6456     -603     
==========================================
- Hits         5529     5032     -497     
+ Misses       1530     1424     -106     
Flag Coverage Δ
frontend 77.94% <95.38%> (-0.38%) ⬇️
javascript 77.94% <95.38%> (-0.38%) ⬇️
smokeTest ?
unitTest 77.94% <95.38%> (-0.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/app/app.py 62.20% <52.63%> (+0.66%) ⬆️
server/dataset/dataset.py 73.99% <60.00%> (-0.12%) ⬇️
server/dataset/cxg_dataset.py 84.76% <66.66%> (+0.22%) ⬆️
server/common/config/config_model.py 98.36% <98.36%> (ø)
server/app/api/util.py 100.00% <100.00%> (ø)
server/app/api/v3.py 96.99% <100.00%> (ø)
server/common/config/app_config.py 95.55% <100.00%> (+13.48%) ⬆️
server/common/config/client_config.py 83.87% <100.00%> (+0.53%) ⬆️
server/common/health.py 89.47% <100.00%> (+2.51%) ⬆️
server/common/rest.py 80.70% <100.00%> (ø)
... and 25 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Bento007 Bento007 changed the title change default_config to yml file Simplify Config Nov 2, 2022
@Bento007 Bento007 force-pushed the tsmith/119-config branch 5 times, most recently from b323453 to 3a58992 Compare November 16, 2022 21:53
server/cli/launch.py Outdated Show resolved Hide resolved
@Bento007 Bento007 requested a review from ebezzi November 23, 2022 20:29
@Bento007 Bento007 self-assigned this Nov 23, 2022
@Bento007 Bento007 enabled auto-merge (squash) November 23, 2022 20:32
@Bento007 Bento007 merged commit 0248748 into main Nov 23, 2022
@Bento007 Bento007 deleted the tsmith/119-config branch November 23, 2022 20:44
Bento007 added a commit that referenced this pull request Dec 1, 2022
- Merge `server_config` and `dataset_config` into `app_config`. This adds more complexity than needed.
- Validate `app_config` using pydantic. This greatly simplifies the config validation processes and uses existing python type hinting to do it. 
- modify `AppConfig.__init__` to accept a file name as a parameter.
- Remove `external_config` and `secret_config`. This added more complexity that we weren't really using. Pydnatic support this functionality and we can add it back in the future if needed.
- Remove getting config from environment variables. This is part of removing the external config. 
- Remove the `external` section from config. This is part of removing the external config. 
- Rename the `dataset` config parameter to `default_dataset`. This is a better description of what it is.
- Add `dataroots` config parameter where multiple dataroots can be specified. To simplify the requirement that `dataroot` can be both a string and dictionary, `dataroots` was added to contain the dictionary version of `dataroot`. This simplifies the configuration and validation logic and adds minimal overhead.
- Rename `s3: region_name` config parameter to `s3_region_name`. This simplifies the config by reducing the nesting level for a single key dictionary.
- Rename `MatrixDataLoader` to `DataLoader`. This was a TODO in the code.
- Use `current_app.app_config` in the API handlers rather than passing `app_config` as a parameter. This reduces the complexity of the interface for some of the API handlers.
- Remove `per_dataset_config` because it's not used and adds significant complexity.
- Remove `allowed_matrix_types` because only CXG is supported.
- Remove `get_title` and `get_about` from `app_config`. All it does is wrap the equivalent data_adapter function.
- Remove obsolete tests.

Co-authored-by: Andrew Tolopko <atolopko-czi@users.noreply.github.com>
@atarashansky
Copy link
Contributor

@Bento007 @ebezzi this PR broke local development.

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.

3 participants