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

Add profiling & benchmarks for Indexset and Parameter -- clean #150

Open
wants to merge 118 commits into
base: main
Choose a base branch
from

Conversation

glatterf42
Copy link
Member

In #148, we're adding a very large data file: big/parameterdata.csv has almost 100MB. In order to avoid bloating the git history of this repo, this PR was created loosely following the procedure outlined here: I created a clean clone of ixmp4 and rewrote its history to remove the very large file from it entirely. Then I merged the resulting branch back into a branch freshly started off of main, and I'm using this to open this PR.

The preview shows 116 commits, but it's actually just one, merging the clean branch to the new one. The files changed seems reasonable, though, so I figure we should be fine by squashing these apparent commits when merging.

meksor and others added 30 commits April 18, 2023 12:07
* Update installation in README

* Update installation in DEVELOPING

* Add dynamic versioning

* Add publish workflow

* Update poetry publish version

* Add info about releasing and version number
* Migrate candidate 0.2.0 version

* delete version test
* Try enabling postgres

* Explicitly install libpq-dev

* Remove libpq-dev since it's already installed

* Switch psycopg2 to psycopg2-binary

* Revert poetry.lock

* Try installing python-dev

* Fix apt-get install command

* Add alternative publish workflow

* Add dynamic versioning

* Set up alternative publishing workflow for repositories

* Fix faulty publish workflow

* Enable using trusted publisher

* Make alternative publish workflow proper

* Add missing permission setting
* Merge current state of ixmp4-dev into ixmp4
* Files have been selected based on a diff of the two repos
* Where changes were detected, ixmp4-dev version was used

* Remove falsely added dynamic-versioning dependencies
* Add isort as part of dev dependencies

* Apply isort to all files

* Update anyio and pandas dependencies

* Specify import location of Backend to resolve circular import
* Update GHA to run on python 3.10 and 3.11

* Introduce GHA checks for black and isort on PRs

* Update badges to show python 3.11 support

* Run GHA only on necessary python versions

* Combine code style checks in lint.yaml

* Update README.md (#15)

* Combine updated python badges

* Add build in dev dependency group

---------

Co-authored-by: Daniel Huppmann <[email protected]>
* regress tests

* fix wrong types for *like lookups supplied
* adjust dependency psycopg2->psycopg[binary]

* require postgresql+psycopg:// in dsn

* replace old dsn prefix to keep .toml backwards compatibility

* update docs
* Adapt to pydantic v2.4, fastapi 0.103

* Let pydantic return a SchemaError instead of InconsistentIamcType

* Use pandera.DataFrameModel instead of pandera.SchemaModel

* Clean up changes in API layer

* Make creation information optional in iamc/variable
* Make id and name required for unit
* Revert bulk_* changes to use json_encoder of api.DataFrame again
* NOTE: this option will be deprecated in the future,
* pydantic serialization decorators should be used instead

* Clean up changes in data/db to enable tests again

* Revert use of Annotated in iamc/datapoint/filter
* Make sqla_model a proper ClassVar (rather than private attr)

* Set field.alias only when it does not equal field.name

* Update version of ruff

* Set field alias in Field directly

* Use httpx-preferred content to send bytes/raw content/json st

* Use alias for model_ fields that conflict with pydantic protected namespace

* Use variable rather than unmapped class reference to resolve SAwarning

* Delete unused import

* Bump mypy and poetry versions

* Use pre-commit over lint-GHA

* Runs mypy, black, ruff
* NOTE: needs to be run in the repo s.t. poetry detects the correct venv
* Remove separate lint.yaml action

* Bump sphinx version

* Update docstrings according to new sphinx version

* Delete duplicate docs files

* TEMPORARY Use own fork for sphinxcontrib-openapi workaround

* Bump dask,sqlalchemy,pre-commit versions

* restore filter framework api

* fix union types with filter subojects

* fix code style

* fix formatting error

* Remove outdated comments

* Update various things:

* Bump fastapi,black,ruff,mypy versions
* Update pre-commit-config accordingly
* Update doc/source/openapi-v1.json

* Include pre-commit, ruff, etc in DEVELOPING.md

---------

Co-authored-by: Max Wolschlager <[email protected]>
glatterf42 and others added 22 commits October 3, 2024 10:45
* Introduce optimization.Variable
* Make constrained_to_indexset optional for scalar Variables
* Fix and test variable list and tabulate for specific runs
* Fix name of Variable table
* Introduce variable.remove_data()
* Remove superfluous session.add() for variable
* Use own errors for Variable
* Introduce optimization.Equation
* Fix and test equation list and tabulate for specific runs
* Introduce equation.remove_data()
* Remove superfluous session.add() for equation
* Use own errors for Equation
* try to use NullPool to fix idle connection issue

* omit session.rollback

* add engine.dispose again

* Bump versions of pre-commit tools

* Delete old ixmp version of transport tutorial

---------

Co-authored-by: Fridolin Glatter <[email protected]>
* Enable Codecov uploading and reporting on CI
* Remove Codecov terminal output
* implement SqlaEventHandler.pause ctx manager

* pause event handlers during re-setting of default version

* adjust tests
* Run whole test suite also on pushes to main
* Remove outdated build-docs workflow
* Add new DB data types and imports
* Refactor indexset.add_data()
* Introduce new IndexSetData table to normalize data
* Rename .elements to .add for consistency
* Adapt tests to refactoring
* Cast types using numpy for efficiency
* Reduce number of lines needing tests
* Make data loading during tabulate() optional
* Use bulk insert for IndexSetData
* Use a normal property for `.data`
* Remove not-required parameter
* Add all missing and new db migrations
* Add support for Python 3.13
* Adapt badge on readme page
* Adapt test for 3.12 and 3.13
* Bump various dependencies to support 3.13 in lock file
* Complete type hints
* Bump mypy to latest release version
* Enable mypy for docs and tests
* Note reasons for type: ignore for future reference
* DRY enumerate kwargs
* DRY more type hints using TypeAlias
* Exclude if TYPE_CHECKING from coverage
* Add mypy badge to README
* Make scalar.unit non-optional
* Bump pandas version in poetry.lock
* Add abstraction layer for core optimization reusability
* Add annotations
@glatterf42 glatterf42 added the enhancement New feature or request label Jan 16, 2025
@glatterf42 glatterf42 self-assigned this Jan 16, 2025
Base automatically changed from fix/avoid-superfluous-db-calls-from-core to main January 16, 2025 14:07
@glatterf42 glatterf42 requested a review from meksor January 16, 2025 14:14
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.9%. Comparing base (0deac5b) to head (d18873e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #150     +/-   ##
=======================================
- Coverage   86.9%   86.9%   -0.1%     
=======================================
  Files        230     230             
  Lines       8156    8144     -12     
=======================================
- Hits        7095    7082     -13     
- Misses      1061    1062      +1     
Files with missing lines Coverage Δ
ixmp4/core/optimization/equation.py 93.5% <100.0%> (ø)
ixmp4/core/optimization/indexset.py 91.5% <100.0%> (ø)
ixmp4/core/optimization/parameter.py 93.3% <100.0%> (ø)
ixmp4/core/optimization/table.py 92.5% <100.0%> (ø)
ixmp4/core/optimization/variable.py 93.6% <100.0%> (ø)
ixmp4/data/db/optimization/equation/model.py 100.0% <100.0%> (ø)
ixmp4/data/db/optimization/parameter/model.py 100.0% <100.0%> (ø)
ixmp4/data/db/optimization/table/model.py 100.0% <100.0%> (ø)
ixmp4/data/db/optimization/utils.py 100.0% <100.0%> (ø)
ixmp4/data/db/optimization/variable/model.py 100.0% <100.0%> (ø)

... and 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants