mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-07-20 16:58:12 +00:00
FAstAPI is an async framework. Data may be imported and exported, load and save, set and get asynchronously. Prevent interleaving data operations to corrupt the data. In the previous design sync and async data access was intermixed leading to data corruption. The basic data classes DataSequence and DataContainer and the derived classes like Provider and Measurement now are async. Data access is protected by several async locks. To support the async design of the data classes the database interface became async. The energy management is also adapted to the new async design. Optimization is still off-loaded to another thread, but the prepration for the optimization and the post optimization actions now follow the async design. Adapter operations are now also protected by async locks. Tests were adapted to the async design and new tests were created. Besides this major fix several other improvements and fixes are included in this PR. * fix: key_to_dict/list/array only regard data records with key value set. Before the exclusion of no value data records was only done if the dropna flag was set. * fix: test for visual result pdf generation Due to updates in the library the generated charts text was a little bit different. Adapt the test to create the comaprison pdf in the test data durectory and update the reference pdf. * chore: Remove MutableMapping from DataSequence and DataContainer. Mutable Mapping does not fit to the now async design. * chore: Add NoDB database backend This backend implements the full database backend interface but performs no actual persistence. It is intended for configurations where database persistence is disabled (`provider=None`). * chore: Improve measurement data import testing with real world scenarios. Added two new endpoints to support testing. * chore: Add mermaid to supported documentation tools * chore: Add documentation about async design * chore: Add documentation about generic data handling Covers the basics of measurement and prediction time series data handling. * chore: Add empty lines around markdown lists. * chore: sync pre-commit config to updated package versions Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
3.2 KiB
3.2 KiB
Configuration model for database settings
Attributes: provider: Optional provider identifier (e.g. "LMDB"). max_records_in_memory: Maximum records kept in memory before auto-save. auto_save: Whether to auto-save when threshold exceeded. batch_size: Batch size for batch operations.
:::{table} database :widths: 10 20 10 5 5 30 :align: left
| Name | Environment Variable | Type | Read-Only | Default | Description |
|---|---|---|---|---|---|
| autosave_interval_sec | EOS_DATABASE__AUTOSAVE_INTERVAL_SEC |
Optional[int] |
rw |
10 |
Automatic saving interval [seconds]. |
| Set to None to disable automatic saving. | |||||
| batch_size | EOS_DATABASE__BATCH_SIZE |
int |
rw |
100 |
Number of records to process in batch operations. |
| compaction_interval_sec | EOS_DATABASE__COMPACTION_INTERVAL_SEC |
Optional[int] |
rw |
604800 |
Interval in between automatic tiered compaction runs [seconds]. |
| Compaction downsamples old records to reduce storage while retaining coverage. Set to None to disable automatic compaction. | |||||
| compression_level | EOS_DATABASE__COMPRESSION_LEVEL |
int |
rw |
9 |
Compression level for database record data. |
| initial_load_window_h | EOS_DATABASE__INITIAL_LOAD_WINDOW_H |
Optional[int] |
rw |
None |
Specifies the default duration of the initial load window when loading records from the database, in hours. If set to None, the full available range is loaded. The window is centered around the current time by default, unless a different center time is specified. Different database namespaces may define their own default windows. |
| keep_duration_h | EOS_DATABASE__KEEP_DURATION_H |
Optional[int] |
rw |
None |
Default maximum duration records shall be kept in database [hours, none]. |
| None indicates forever. Database namespaces may have diverging definitions. | |||||
| provider | EOS_DATABASE__PROVIDER |
Optional[str] |
rw |
None |
Database provider id of provider to be used. |
| providers | List[str] |
ro |
N/A |
Return available database provider ids. | |
| ::: |
Example Input
{
"database": {
"provider": "LMDB",
"compression_level": 0,
"initial_load_window_h": 48,
"keep_duration_h": 48,
"autosave_interval_sec": 5,
"compaction_interval_sec": 604800,
"batch_size": 100
}
}
Example Output
{
"database": {
"provider": "LMDB",
"compression_level": 0,
"initial_load_window_h": 48,
"keep_duration_h": 48,
"autosave_interval_sec": 5,
"compaction_interval_sec": 604800,
"batch_size": 100,
"providers": [
"LMDB",
"SQLite",
"NoDB"
]
}
}