mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-10-21 21:31:57 +00:00
perf: import heavy optional dependencies on first use (#1377)
A GENETIC server with external (import) providers and EOSdash disabled loads several large packages at start that it never uses, which costs a noticeable part of the memory on 512 MB boards: - matplotlib via the GENETIC/GENETIC0 PDF report modules (server/eos.py) - statsmodels via the Holt-Winters fallback in prediction/priceabc.py - pvlib via the weather base class and the pvlib-based providers - bs4/lxml via the ClearOutside provider - scipy via the self-consumption interpolator singletons, which were loaded at import time - the GENETIC0 optimizer, imported by core/ems.py - tzfpy, whose polygon data the computed general.timezone loads Import these where they are used. The interpolator tables are loaded on first use (thread-safe). Nothing changes in what is computed. general.timezone is computed from latitude/longitude and cannot be set. Add general.timezone_override (IANA name, validated with pendulum): when set, general.timezone returns it and the lookup is skipped. When unset (default) the lookup is unchanged. Tests that patched the moved names now patch them at their source. A new test starts the server module in a subprocess and checks that none of these modules is loaded. Co-authored-by: Christin <christin@BigBrother.bikini.bottom.zone> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Christin
Claude Opus 5.5
parent
6d26252c6a
commit
3651d33915
@@ -38,6 +38,8 @@ compatibility changes and a short test procedure. These changes are not yet a ta
|
||||
and coverage information. A capacity estimate does not overwrite configured capacity.
|
||||
- Optional local, calibratable forecasting within `PVForecastAkkudoktor`; the remote
|
||||
backend remains the default.
|
||||
- Optional `general.timezone_override`: an IANA timezone name used as `general.timezone`
|
||||
instead of the lookup from latitude/longitude. Unset (default), the lookup is unchanged.
|
||||
- New PV forecast providers giving operators more cloud forecast sources to choose from in
|
||||
addition to Akkudoktor, VRM and Import:
|
||||
- `PVForecastPVNode` — native 15-minute forecasts from the pvnode.com API.
|
||||
@@ -60,6 +62,9 @@ compatibility changes and a short test procedure. These changes are not yet a ta
|
||||
values. Runtime forecast energy is Wh per slot and prices are currency per Wh.
|
||||
- Runtime configuration changes now take priority over environment and file values for
|
||||
explicitly updated keys; command-line settings retain higher priority.
|
||||
- Lower idle memory: matplotlib (PDF reports), statsmodels (price fallback forecast), pvlib,
|
||||
bs4/lxml, scipy (self-consumption table), the GENETIC0 optimizer and the timezone lookup
|
||||
data are imported on first use instead of at server start. Results are unchanged.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
Reference in New Issue
Block a user