mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-10-13 01:21:58 +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
+33
-1
@@ -6737,6 +6737,22 @@
|
||||
"title": "Longitude",
|
||||
"description": "Longitude in decimal degrees within -180 to 180 (\u00b0)",
|
||||
"default": 13.405
|
||||
},
|
||||
"timezone_override": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Timezone Override",
|
||||
"description": "IANA timezone name, e.g. 'Europe/Berlin'. If set, 'timezone' is this value instead of the timezone looked up from latitude and longitude, and the lookup data (~25 MB) is never loaded. Defaults to None (look up).",
|
||||
"examples": [
|
||||
null,
|
||||
"Europe/Berlin"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
@@ -6829,6 +6845,22 @@
|
||||
"description": "Longitude in decimal degrees within -180 to 180 (\u00b0)",
|
||||
"default": 13.405
|
||||
},
|
||||
"timezone_override": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Timezone Override",
|
||||
"description": "IANA timezone name, e.g. 'Europe/Berlin'. If set, 'timezone' is this value instead of the timezone looked up from latitude and longitude, and the lookup data (~25 MB) is never loaded. Defaults to None (look up).",
|
||||
"examples": [
|
||||
null,
|
||||
"Europe/Berlin"
|
||||
]
|
||||
},
|
||||
"timezone": {
|
||||
"anyOf": [
|
||||
{
|
||||
@@ -6839,7 +6871,7 @@
|
||||
}
|
||||
],
|
||||
"title": "Timezone",
|
||||
"description": "Computed timezone based on latitude and longitude.",
|
||||
"description": "Timezone: 'timezone_override' if set, else looked up from latitude and longitude.",
|
||||
"readOnly": true
|
||||
},
|
||||
"data_output_path": {
|
||||
|
||||
Reference in New Issue
Block a user