Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
5afc64d
Add `Temperature` quantity
christianparpart Jul 7, 2023
0e5efed
Add ComponentMetricId.TEMPERATURE_MAX and the ability to retrieve thi…
christianparpart Jul 7, 2023
09932bd
Add TemperatureMetrics to timeseries.battery_pool
christianparpart Jul 7, 2023
9dfb5a6
Add BatteryPool.temperature metrics receiver
christianparpart Jul 7, 2023
eca91fb
Nice error message for empty buffer and new test case
jack-herrmann Jul 17, 2023
b9ea7f1
Bump mkdocs-material from 9.1.18 to 9.1.19
dependabot[bot] Jul 19, 2023
ac70fde
Bump mkdocs-material from 9.1.18 to 9.1.19 (#521)
Marenz Jul 19, 2023
c5af86b
Bump polars from 0.18.7 to 0.18.8
dependabot[bot] Jul 21, 2023
46d8630
Bump polars from 0.18.7 to 0.18.8 (#526)
Marenz Jul 21, 2023
da6a5ce
Add capability to multiply quantities with percentage
Marenz Jul 13, 2023
0c50e4b
Add capability to multiply quantities with percentage (#512)
Marenz Jul 21, 2023
1043360
Implement dunder iadd, isub, imul methods for Quantity
shsms Jul 21, 2023
74481c1
Implement dunder iadd, isub, imul methods for Quantity (#527)
shsms Jul 21, 2023
68a7360
Bump types-protobuf from 4.23.0.1 to 4.23.0.2
dependabot[bot] Jul 24, 2023
2472817
Bump types-protobuf from 4.23.0.1 to 4.23.0.2 (#528)
matthias-wende-frequenz Jul 24, 2023
207d96a
Add token type CONSTANT
matthias-wende-frequenz Jul 18, 2023
7dc5283
Support constants in arithmetic FormulaEngine operations
matthias-wende-frequenz Jul 18, 2023
d47c657
Add test for composing formulas with constants
matthias-wende-frequenz Jul 20, 2023
dcc4b30
Add failing tests for formula composition
matthias-wende-frequenz Jul 24, 2023
674ac1a
Move formula evaluator to separate file
matthias-wende-frequenz Jul 24, 2023
fdb8a51
Update release notes
matthias-wende-frequenz Jul 21, 2023
520406f
Add constant to FormulaEngine arithmetic (#525)
matthias-wende-frequenz Jul 24, 2023
4009eec
Remove support for hashing of `Quantity` objects
shsms Jul 24, 2023
247c081
Document internal representation of `Quantity` objects as `float`s
shsms Jul 24, 2023
ee43f49
Add `isclose()` method for `Quantity` objects
shsms Jul 24, 2023
bc37e7c
Add RELEASE_NOTES entries
shsms Jul 25, 2023
8c9bcae
Quantity improvements (#533)
shsms Jul 26, 2023
6d4f2ad
Rewrite component data wrapper classes to not redefine data fields
shsms Jul 10, 2023
0efb86a
Allow MockMicrogrid battery chains without meters
shsms Jul 5, 2023
4803deb
Update logical meter grid power test to use a battery without a meter
shsms Jul 5, 2023
7990567
Update PowerDistributingActor constructor test to use MockMicrogrid
shsms Jul 5, 2023
ccb9e29
Expose internal mock_client to users of MockMicrogrid
shsms Jul 5, 2023
691d6a5
Use constant BATTERY_ID instead of hardcoded number
shsms Jul 10, 2023
1c8f58b
Update PowerDistributingActor tests to use MockMicrogrid
shsms Jul 6, 2023
018e176
Remove hardcoded component graph and fixtures
shsms Jul 10, 2023
82d5834
Check that minimum blocking duration is not greater than the maximum
shsms Jul 11, 2023
478b82b
Ensure component data is stale after receiving a timer event
shsms Jul 18, 2023
d38764e
Add recovery tests for BatteryStatusTracker
shsms Jul 18, 2023
72178a2
Add BatteryStatus tests to ensure it recovers automatically after iss…
shsms Jul 26, 2023
6f79353
Nice error message for empty buffer and new test case (#517)
matthias-wende-frequenz Jul 26, 2023
6885e32
Bump pylint from 2.17.4 to 2.17.5
dependabot[bot] Jul 27, 2023
bb9fcfb
Bump pylint from 2.17.4 to 2.17.5 (#539)
llucax Jul 27, 2023
3f2b5ee
Update to repo-config v0.4.0
llucax Jul 27, 2023
6a50238
Update to repo-config v0.4.0 (#540)
llucax Jul 27, 2023
5d32be8
Bump mkdocs-material from 9.1.19 to 9.1.21
dependabot[bot] Jul 28, 2023
64a33ce
Bump mkdocs-material from 9.1.19 to 9.1.21 (#549)
Marenz Jul 28, 2023
3f414ed
Merge draft implementation from christianparpart
shsms Jul 28, 2023
ada7a61
Add tests for the `Temperature` quantity
shsms Jul 28, 2023
25cd074
Rename `temperature_max` fields to `temperature`
shsms Jul 26, 2023
3ae0941
Replace `TemperatureMetrics` with `Sample[Temperature]`
shsms Jul 26, 2023
f10dfc6
Add tests for `battery_pool.temperature`
shsms Jul 28, 2023
f9cc2ab
Bump polars from 0.18.8 to 0.18.9
dependabot[bot] Jul 31, 2023
84ade2f
Bump polars from 0.18.8 to 0.18.9 (#553)
daniel-zullo-frequenz Jul 31, 2023
80ac74e
Bump polars from 0.18.9 to 0.18.11
dependabot[bot] Aug 1, 2023
5deb7d1
Bump polars from 0.18.9 to 0.18.11 (#554)
llucax Aug 1, 2023
1cd226b
Remove dunder iadd, isub and imul methods for Quantity
llucax Aug 1, 2023
361bcb0
Add zero() constructor for Quantities
llucax Jul 26, 2023
228700a
Update RELEASE_NOTES.md
shsms Aug 1, 2023
82084a6
Add zero() constructor for Quantities (#535)
llucax Aug 1, 2023
18036e4
Update src/frequenz/sdk/microgrid/component/_component_data.py
shsms Aug 1, 2023
759228e
Merge remote-tracking branch 'origin/v0.x.x' into battery-pool-temp
shsms Aug 1, 2023
3eae96b
Temperature streaming from the BatteryPool (#552)
shsms Aug 1, 2023
2a240fe
Update battery pool SoC calculation
matthias-wende-frequenz Aug 1, 2023
83888c5
Update release notes
matthias-wende-frequenz Aug 2, 2023
2f11f0d
Update battery pool SoC calculation (#557)
matthias-wende-frequenz Aug 2, 2023
bcd993d
Add CI check that RELEASE_NOTES.md was updated
Marenz Jul 27, 2023
3e53f01
Add CI check that RELEASE_NOTES.md was updated (#544)
Marenz Aug 2, 2023
46898ee
Improve test that raises an exception
llucax Aug 3, 2023
b1a4c79
Fix and add missing release notes
llucax Aug 3, 2023
58ca166
Prepare for release v0.23.0 (#559)
llucax Aug 3, 2023
5308a85
Resampler emits sample as regularly as possible using Timer.periodic
jack-herrmann Jul 18, 2023
8b94622
Fix resample timer drifting tests
llucax Jul 24, 2023
bbaf3d3
Preserve the state of the resampling timer
llucax Jul 24, 2023
026544a
Properly align the timer to align_to
llucax Jul 25, 2023
cc4a21f
Always wait for at least one resampling period
llucax Jul 25, 2023
f11a030
Rename receiver/sender variables to make more sense
llucax Jul 26, 2023
cfede0a
Use `Timer.periodic` in the `Resampler` (#520)
llucax Aug 3, 2023
6fedb02
Clear release notes
llucax Aug 3, 2023
e256507
Allow running release notes check in merge queues
llucax Aug 4, 2023
974a9ea
Allow running release notes check in merge queues (#566)
llucax Aug 4, 2023
a25fab7
Clear release notes (#560)
llucax Aug 4, 2023
aba0576
Update `frequenz-api-microgrid` to version 0.15.1
shsms May 31, 2023
74a9b92
Add inclusion/exclusion bounds to low-level component data types
shsms May 31, 2023
be64e00
Use inclusion bounds to replace older bounds fields
shsms May 31, 2023
1638430
Use `ComponentCategory` from frequenz-api-common package
shsms May 31, 2023
f3e3d41
Update MicrogridGrpcClient and tests to use latest grpc methods
shsms May 31, 2023
f1203d4
Update mock api to mock the v0.15.1 of the api
shsms May 31, 2023
228c6c4
Import Bounds from the frequenz-api-common package
shsms May 31, 2023
c103d1c
Disable pylint rules that started failing after updating to v0.15.1
shsms May 31, 2023
4708546
Fetch `component_type` from component metadata
shsms May 31, 2023
1fffefa
Update RELEASE_NOTES.md
shsms Aug 3, 2023
aa75e4f
Update `frequenz-api-microgrid` to v0.15.1 (#416)
shsms Aug 4, 2023
5ef4d13
Rename internal inclusion-bound variables to latest naming scheme
shsms Jul 20, 2023
f4e51f2
Support fetching of exclusion bounds from the data sourcing actor
shsms Jul 20, 2023
6bf4805
Rename BatteryPool.Bound to `Bounds`
shsms Jul 20, 2023
77a4548
Rename fields to power inclusion/exclusion bounds, in battery pool
shsms Jul 21, 2023
bbf2a0c
Use `Power` objects to represent power bounds in battery pool
shsms Jul 21, 2023
dfa6edf
Refactor inclusion_bounds extraction code to a separate method
shsms Jul 24, 2023
a3797b6
Implement fetching and streaming of exclusion bounds in battery pool
shsms Jul 24, 2023
5bb5bb3
Update RELEASE_NOTES.md
shsms Aug 3, 2023
1e9e509
Use built-in types for typing
llucax Aug 4, 2023
3e0566b
Improve documentation for `ConfigManagingActor`
llucax Aug 4, 2023
2ef482c
Improve logging for `ConfigManagingActor`
llucax Aug 4, 2023
6019072
Add missing type hints to attributes
llucax Aug 4, 2023
36ecb42
Rename `conf_file` to `config_path` and accept `pathlib.Path`
llucax Aug 4, 2023
f22a5c0
Add clarification about watching the parent directory
llucax Aug 4, 2023
3c725e7
Use match to process the file watcher events
llucax Aug 4, 2023
8d0fa20
Bump brettcannon/check-for-changed-files
dependabot[bot] Aug 7, 2023
b48aa3e
Update tag comment for `check-for-changed-files` action
llucax Aug 7, 2023
2ec38f4
Improvements to the `ConfigManagingActor` (#565)
llucax Aug 7, 2023
628d771
Bump brettcannon/check-for-changed-files from 294a99714e0d350b5083472…
llucax Aug 7, 2023
13165e7
Bump types-protobuf from 4.23.0.2 to 4.23.0.3
dependabot[bot] Aug 7, 2023
d8fc5bd
Bump polars from 0.18.11 to 0.18.12
dependabot[bot] Aug 7, 2023
0261e96
Bump types-protobuf from 4.23.0.2 to 4.23.0.3 (#568)
Marenz Aug 7, 2023
609d9ab
Bump polars from 0.18.11 to 0.18.12 (#569)
Marenz Aug 7, 2023
93ce466
Bump polars from 0.18.12 to 0.18.13
dependabot[bot] Aug 8, 2023
639394c
Replace `Power.from_watts(0)` with `Power.zero()`
llucax Aug 8, 2023
d7c524d
Stream exclusion bounds from the battery pool (#537)
llucax Aug 8, 2023
d574ae3
Add a `_get_bounds` method in PowerDistributingActor
shsms Aug 1, 2023
d430343
Remove unused `to_protobuf` method in power distribution tests
shsms Aug 1, 2023
db23e32
Support exclusion bounds in power distribution tests
shsms Aug 1, 2023
12749c1
Respect exclusion bounds in `PowerDistributingActor._check_request`
shsms Aug 1, 2023
de1331d
Refactor to reduce the amount of calls to the component data cache
shsms Aug 2, 2023
3ee0f27
Update distribution algorithm to support exclusion bounds
shsms Aug 3, 2023
ffb95bf
Extract reusable `create_components` method outside test class
shsms Aug 4, 2023
03a3cae
Test exclusion bounds in power distribution algorithm
shsms Aug 4, 2023
390096c
Update RELEASE_NOTES.md
shsms Aug 8, 2023
8fe9ee3
mkdocs: Add cross-linking object inventory for APIs
llucax Aug 9, 2023
62a4639
Change links to the source with links to the docs
llucax Aug 9, 2023
c3418aa
Remove leftover `print()`
llucax Aug 9, 2023
f034cc4
Use `is_close_to_zero()` instead of `math.isclose(..., abs_tol=...)`
llucax Aug 9, 2023
a0c7a11
Bump polars from 0.18.12 to 0.18.13 (#570)
Marenz Aug 9, 2023
be9d239
Simplify `a < b < c` comparison
llucax Aug 9, 2023
fd18523
Add docs cross-linking to APIs (#571)
llucax Aug 9, 2023
6258c76
Support exclusion bounds in power distributor (#562)
llucax Aug 9, 2023
4a4c49a
Update release notes for the v0.24.0 release
llucax Aug 9, 2023
1d45fc9
Update release notes for the v0.24.0 release (#573)
llucax Aug 9, 2023
a77bd54
Bump types-protobuf from 4.23.0.3 to 4.24.0.0
dependabot[bot] Aug 10, 2023
f22149d
Remove absolute tolerance in floating-point comparison
daniel-zullo-frequenz Aug 9, 2023
fdd9e27
Remove redundant deficits updates
daniel-zullo-frequenz Aug 9, 2023
91fe22a
Consolidate deficits for-loops
daniel-zullo-frequenz Aug 10, 2023
8bc19bc
Fix updating gaps code
matthias-wende-frequenz Aug 10, 2023
79c373f
Add test for gap update code in fix_ringbuffer
matthias-wende-frequenz Aug 10, 2023
38ac7fb
Add test to remove single gap if outdated
matthias-wende-frequenz Aug 10, 2023
d8eaaeb
Update release notes
matthias-wende-frequenz Aug 10, 2023
7bbfd10
Fix ring buffer gap cleanup code (#578)
matthias-wende-frequenz Aug 10, 2023
78d8d4c
Amend deficit calculation in the power distributor (#577)
daniel-zullo-frequenz Aug 10, 2023
1672a70
Clear release notes
llucax Aug 9, 2023
8521ddc
Clear release notes (#574)
llucax Aug 10, 2023
4ca07bd
Bump types-protobuf from 4.23.0.3 to 4.24.0.0 (#576)
Marenz Aug 10, 2023
84158f6
Bump mypy from 1.4.1 to 1.5.0
dependabot[bot] Aug 11, 2023
922691a
Bump mypy from 1.4.1 to 1.5.0 (#580)
Marenz Aug 14, 2023
6117707
Bump time-machine from 2.11.0 to 2.12.0
dependabot[bot] Aug 15, 2023
786569d
Put frequently used code in base function.
Marenz Aug 15, 2023
dcf7b0d
Properly handle PV power requests when no or only some meters exist.
Marenz Aug 15, 2023
ee58323
Support PV configurations with no or only some meters (#584)
Marenz Aug 16, 2023
96e3696
Bump mypy from 1.5.0 to 1.5.1
dependabot[bot] Aug 17, 2023
caa22f3
Bump mypy from 1.5.0 to 1.5.1 (#585)
llucax Aug 17, 2023
61271d2
Bump types-protobuf from 4.24.0.0 to 4.24.0.1
dependabot[bot] Aug 17, 2023
0152770
Bump types-protobuf from 4.24.0.0 to 4.24.0.1 (#581)
llucax Aug 17, 2023
93110d1
Bump time-machine from 2.11.0 to 2.12.0 (#582)
llucax Aug 18, 2023
8565fe5
Resampling: Reuse existing variable.
Marenz Aug 17, 2023
0401ede
PvPowerFormula: Fix comment typo
Marenz Aug 17, 2023
6e2aad3
Some very small fixes (#590)
Marenz Aug 18, 2023
2e6ca85
MockMicrogrid: Add a consumer meter only explicitly.
Marenz Aug 10, 2023
0f8063f
Add some tests for scenarios with no meter.
Marenz Aug 18, 2023
14f4cd8
Fix `consumer_power()` not working certain configurations.
Marenz Aug 18, 2023
889f9a4
Bump mkdocs-material from 9.1.21 to 9.2.1
dependabot[bot] Aug 22, 2023
17b3627
Bump mkdocs-material from 9.1.21 to 9.2.1 (#592)
llucax Aug 22, 2023
cac5473
Fix `consumer_power()` not working certain configurations. (#589)
Marenz Aug 22, 2023
d3f7fdf
Add function that returns the grid component
matthias-wende-frequenz Aug 17, 2023
1b6c74b
Add dfs component search to component graph
matthias-wende-frequenz Aug 21, 2023
4b456df
Add tests for graph DFS search
matthias-wende-frequenz Aug 22, 2023
3b65d59
[ci] Add test for installation in multiple architectures
tiyash-basu-frequenz Aug 23, 2023
5ac30b1
[ci] Publish docs only if installation test succeeds
tiyash-basu-frequenz Aug 23, 2023
61e993e
Update Release Notes
matthias-wende-frequenz Aug 23, 2023
31aa32b
Add depth first search for components (#595)
matthias-wende-frequenz Aug 23, 2023
1186f6f
[ci] Add test for installation in multiple architectures (#597)
tiyash-basu-frequenz Aug 24, 2023
1517b4f
Improve pv power formula
matthias-wende-frequenz Aug 17, 2023
d422e0d
Improve producer power formula
matthias-wende-frequenz Aug 22, 2023
3532396
Add test pv with no pv components
matthias-wende-frequenz Aug 23, 2023
1418d7d
Add no_meter params to add_chps in MockMicrogrid
matthias-wende-frequenz Aug 23, 2023
b97f220
Fix producer formula test
matthias-wende-frequenz Aug 23, 2023
5134ef8
Update Release Notes
matthias-wende-frequenz Aug 23, 2023
9953eb4
Remove obsolete annotations import
matthias-wende-frequenz Aug 24, 2023
b08ed58
Fix typos in graph DFS docs
matthias-wende-frequenz Aug 24, 2023
10a763b
Improve formula generators (#599)
matthias-wende-frequenz Aug 24, 2023
9db06e4
Move distribution algorithm into power distributing actor package
shsms Aug 21, 2023
40d9355
Remove unused methods in power distributing actor
shsms Aug 21, 2023
62b1f59
Rename power distributing actor result `OutOfBound` -> `OutOfBounds`
shsms Aug 21, 2023
f43a32a
Forward zero power requests always to the microgrid API
shsms Aug 21, 2023
9841ada
Rewrite power distribution algorithm examples as a table
shsms Aug 21, 2023
fa66566
Update release notes
shsms Aug 21, 2023
e48110d
Forward zero power requests always to the microgrid API (#591)
shsms Aug 24, 2023
6e28342
Improve release notes formatting
llucax Aug 25, 2023
2cd0b79
Add a `BackgroundService` abstract base class
llucax Jul 24, 2023
573a71a
Add `Actor` abstract base class
llucax Aug 4, 2023
b4285eb
Support the `Actor` class in `actor.run()`
llucax Aug 15, 2023
4f408b3
Setting the restart limit in `disable_actor_auto_restart` fixture
llucax Aug 15, 2023
d40f9ca
Migrate `ConfigManagingActor` to the `Actor` class
llucax Aug 4, 2023
ab6a421
Make `_ActorInfo` generic
llucax Aug 8, 2023
3c2768f
Make `_data_pipeline.initialize()` async
llucax Aug 8, 2023
338a1b2
Migrate `ComponentMetricsResamplingActor` to the `Actor` class
llucax Aug 8, 2023
cba33f7
Improve `_run()` docs for `ComponentMetricsResamplingActor`
llucax Aug 8, 2023
3a266f8
Migrate `DataSourcingActor` to the `Actor` class
llucax Aug 11, 2023
c5ddca9
Migrate `PowerDistributingActor` to the `Actor` class
llucax Aug 11, 2023
17d4a76
Add optional name to actors
llucax Aug 4, 2023
67a9c22
Convert actor decorator tests to Actor class tests
llucax Aug 15, 2023
0f985e2
Remove actor decorator
llucax Aug 15, 2023
3fd9489
Make `MovingWindow` a `BackgroundService`
llucax Aug 18, 2023
aa8411c
Reset the actor restart limit in the fixture
llucax Aug 21, 2023
034ed05
Use a context manager to temporarily change the restart limit
llucax Aug 21, 2023
3670243
Add a new `actor_auto_restart_once` fixture
llucax Aug 21, 2023
098e48d
Improve and add more actor tests
llucax Aug 21, 2023
33de3dc
Properly propagate `CancelledError` in `wait()`
llucax Aug 21, 2023
a25578e
Add an actor cancellation test
llucax Aug 21, 2023
7dbba78
Add `BackgroundService` tests
llucax Aug 21, 2023
c7b9991
Make darglint ignores markdown comments
llucax Aug 21, 2023
cf12100
Add release notes for `BackgroundService` and `Actor`
llucax Aug 21, 2023
3e7c2fe
Implement BackgroundService and new Actor class (#564)
llucax Aug 25, 2023
1a78115
Replace absolute imports with relative imports
tiyash-basu-frequenz Aug 25, 2023
26db571
Replace absolute imports with relative imports (#604)
tiyash-basu-frequenz Aug 25, 2023
b4759b6
Drop example to private PowerDistributor API
christianparpart Aug 25, 2023
6bbe2fb
Drop example to private PowerDistributor API (#605)
christianparpart Aug 25, 2023
f3c7828
Bump mkdocs-material from 9.2.1 to 9.2.5
dependabot[bot] Aug 28, 2023
3551cd3
Bump mkdocs-material from 9.2.1 to 9.2.5 (#608)
Marenz Aug 28, 2023
24a9374
Improve consumer power formula
matthias-wende-frequenz Aug 24, 2023
f83e14b
Update Release Notes
matthias-wende-frequenz Aug 28, 2023
e139ac3
Fix typo
matthias-wende-frequenz Aug 28, 2023
a6bc133
Remove unnecessary annotations import
matthias-wende-frequenz Aug 28, 2023
c26bb5e
Fix typo in release Notes
matthias-wende-frequenz Aug 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .cookiecutter-replay.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cookiecutter": {
"Introduction": "]\n\nWelcome to repo-config Cookiecutter template!\n\nThis template will help you to create a new repository for your project. You will be asked to provide some information about your project.\n\nHere is an explanation of what each variable is for and will be used for:\n\n* `type`: The type of repository. It must be chosen from the list.\n\n* `name`: The name of the project. This will be used to build defaults for\n other inputs, such as `title`, `python_package`, etc. It should be one word,\n using only alphanumeric characters (and starting with a letter). It can\n include also `_` and `-` which will be handled differently when building\n other variables from it (replaced by spaces in titles for example).\n\n* `description`: A short description of the project. It will be used as the\n description in the `README.md`, `pyproject.toml`, `mkdocs.yml`, etc.\n\n* `title`: A human-readable name or title for the project. It will be used in\n the `README.md`, `CONTRIBUTING.md`, and other files to refer to the project,\n as well as the site title in `mkdocs.yml`.\n\n* `keywords`: A comma-separated list of keywords that will be used in the\n `pyproject.toml` file. If left untouched, it will use only some predefined\n keywords. If anything else is entered, it will be **added** to the default\n keywords.\n\n* `github_org`: The GitHub handle of the organization where the project will\n reside. This will be used to generate links to the project on GitHub.\n\n* `license`: Currently, only two options are provided: `MIT`, which should be\n used for open-source projects, and `Proprietary`, which should be used for\n closed-source projects. This will be added to file headers and used as the\n license in `pyproject.toml`.\n\n* `author_name`, `author_email`: The name and email address of the author of\n the project. They will be used in the copyright notice in file headers and\n as the author in `pyproject.toml`.\n\n* `python_package`: The Python package in which this project will reside. All\n files provided by this project should be located in this package. This needs\n to be a list of valid Python identifiers separated by dots. The source file\n structure will be derived from this. For example, `frequenz.actor.example`\n will generate files in `src/frequenz/actor/example`.\n\n* `pypi_package_name`: The name of the PyPI/wheel/distribution package. This\n should be consistent with the `python_package`, usually replacing `.` with\n `-`. For example, `frequenz-actor-example`.\n\n* `github_repo_name`: The handle of the GitHub repository where the project\n will reside. This will be used to generate links to the project on GitHub and\n as the top-level directory name.\n\n* `default_codeowners`: A space-separated list of GitHub teams (`@org/team`) or\n users (`@user`) that will be the default code owners for this project. This\n will be used to build the `CODEOWNERS` file. Please refer to the [code owners\n documentation] for more details on the valid syntax.\n\n[code owners documentation]: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners\n\n\n[Please press any key to continue",
"type": "lib",
"name": "sdk",
"description": "A development kit to interact with the Frequenz development platform",
Expand All @@ -15,14 +16,41 @@
"default_codeowners": "@frequenz-floss/python-sdk-team",
"_extensions": [
"jinja2_time.TimeExtension",
"local_extensions.as_identifier",
"local_extensions.default_codeowners",
"local_extensions.github_repo_name",
"local_extensions.introduction",
"local_extensions.keywords",
"local_extensions.pypi_package_name",
"local_extensions.python_package",
"local_extensions.src_path",
"local_extensions.title"
],
"_template": "gh:frequenz-floss/frequenz-repo-config-python"
"_template": "gh:frequenz-floss/frequenz-repo-config-python",
},
"_cookiecutter": {
"Introduction": "{{cookiecutter | introduction}}",
"type": [
"actor",
"api",
"app",
"lib",
"model"
],
"name": null,
"description": null,
"title": "{{cookiecutter | title}}",
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
"github_org": "frequenz-floss",
"license": [
"MIT",
"Proprietary"
],
"author_name": "Frequenz Energy-as-a-Service GmbH",
"author_email": "[email protected]",
"python_package": "{{cookiecutter | python_package}}",
"pypi_package_name": "{{cookiecutter | pypi_package_name}}",
"github_repo_name": "{{cookiecutter | github_repo_name}}",
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
}
}
}
10 changes: 10 additions & 0 deletions .github/containers/test-installation/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This dockerfile is used to test the installation of the python package in
# multiple platforms in the CI. It is not used to build the package itself.

FROM --platform=${TARGETPLATFORM} python:3.11-slim

RUN python -m pip install --upgrade --no-cache-dir pip

COPY dist dist
RUN pip install dist/*.whl && \
rm -rf dist
29 changes: 27 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
python -m pip install -e .[dev-noxfile]

- name: Run nox
# To speed things up a bit we use the speciall ci_checks_max session
# To speed things up a bit we use the special ci_checks_max session
# that uses the same venv to run multiple linting sessions
run: nox -e ci_checks_max pytest_min
timeout-minutes: 10
Expand Down Expand Up @@ -83,6 +83,31 @@ jobs:
path: dist/
if-no-files-found: error

test-installation:
name: Test package installation in different architectures
needs: ["build"]
runs-on: ubuntu-20.04
steps:
- name: Fetch sources
uses: actions/checkout@v3
- name: Download package
uses: actions/download-artifact@v3
with:
name: dist-packages
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up docker-buildx
uses: docker/setup-buildx-action@v2
- name: Test Installation
uses: docker/build-push-action@v4
with:
context: .
file: .github/containers/test-installation/Dockerfile
platforms: linux/amd64,linux/arm64
tags: localhost/test-installation
push: false

test-docs:
name: Test documentation website generation
if: github.event_name != 'push'
Expand Down Expand Up @@ -121,7 +146,7 @@ jobs:

publish-docs:
name: Publish documentation website to GitHub pages
needs: ["nox", "build"]
needs: ["nox", "test-installation"]
if: github.event_name == 'push'
runs-on: ubuntu-20.04
permissions:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/release_notes_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release Notes Check

on:
merge_group:
pull_request:
types:
# On by default if you specify no types.
- "opened"
- "reopened"
- "synchronize"
# For `skip-label` only.
- "labeled"
- "unlabeled"


jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
uses: brettcannon/check-for-changed-files@4170644959a21843b31f1181f2a1761d65ef4791 # v1.2.0
with:
file-pattern: "RELEASE_NOTES.md"
prereq-pattern: "src/**"
skip-label: "cmd:skip-release-notes"
failure-message: "Missing a release notes update. Please add one or apply the ${skip-label} label to the pull request"
104 changes: 96 additions & 8 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,110 @@

## Summary

<!-- Here goes a general summary of what this release is about -->
This release replaces the `@actor` decorator with a new `Actor` class.

## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

- `Channels` has been upgraded to version 0.16.0, for information on how to upgrade visit https://github.com/frequenz-floss/frequenz-channels-python/releases/tag/v0.16.0
- The `frequenz.sdk.power` package contained the power distribution algorithm, which is for internal use in the sdk, and is no longer part of the public API.

- `PowerDistributingActor`'s result type `OutOfBound` has been renamed to `OutOfBounds`, and its member variable `bound` has been renamed to `bounds`.

- The `@actor` decorator was replaced by the new `Actor` class. The main differences between the new class and the old decorator are:

* It doesn't start automatically, `start()` needs to be called to start an actor (using the `frequenz.sdk.actor.run()` function is recommended).
* The method to implement the main logic was renamed from `run()` to `_run()`, as it is not intended to be run externally.
* Actors can have an optional `name` (useful for debugging/logging purposes).
* The actor will only be restarted if an unhandled `Exception` is raised by `_run()`. It will not be restarted if the `_run()` method finishes normally. If an unhandled `BaseException` is raised instead, it will be re-raised. For normal cancellation the `_run()` method should handle `asyncio.CancelledError` if the cancellation shouldn't be propagated (this is the same as with the decorator).
* The `_stop()` method is public (`stop()`) and will `cancel()` and `await` for the task to finish, catching the `asyncio.CancelledError`.
* The `join()` method is renamed to `wait()`, but they can also be awaited directly ( `await actor`).
* For deterministic cleanup, actors can now be used as `async` context managers.

Most actors can be migrated following these steps:

1. Remove the decorator
2. Add `Actor` as a base class
3. Rename `run()` to `_run()`
4. Forward the `name` argument (optional but recommended)

For example, this old actor:

```python
from frequenz.sdk.actor import actor

@actor
class TheActor:
def __init__(self, actor_args) -> None:
# init code

def run(self) -> None:
# run code
```

Can be migrated as:

```python
import asyncio
from frequenz.sdk.actor import Actor

class TheActor(Actor):
def __init__(self, actor_args,
*,
name: str | None = None,
) -> None:
super().__init__(name=name)
# init code

def _run(self) -> None:
# run code
```

Then you can instantiate all your actors first and then run them using:

```python
from frequenz.sdk.actor import run
# Init code
actor = TheActor()
other_actor = OtherActor()
# more setup
await run(actor, other_actor) # Start and await for all the actors
```

- The `MovingWindow` is now a `BackgroundService`, so it needs to be started manually with `await window.start()`. It is recommended to use it as an `async` context manager if possible though:

```python
async with MovingWindow(...) as window:
# The moving windows is started here
use(window)
# The moving window is stopped here
```

- The base actors (`ConfigManagingActor`, `ComponentMetricsResamplingActor`, `DataSourcingActor`, `PowerDistributingActor`) now inherit from the new `Actor` class, if you are using them directly, you need to start them manually with `await actor.start()` and you might need to do some other adjustments.

## New Features

- Add quantity class `Frequency` for frequency values.
- Add `abs()` support for quantities.
- Added `DFS` to the component graph

- `BackgroundService`: This new abstract base class can be used to write other classes that runs one or more tasks in the background. It provides a consistent API to start and stop these services and also takes care of the handling of the background tasks. It can also work as an `async` context manager, giving the service a deterministic lifetime and guaranteed cleanup.

All classes spawning tasks that are expected to run for an indeterminate amount of time are likely good candidates to use this as a base class.

- `Actor`: This new class inherits from `BackgroundService` and it replaces the `@actor` decorator.

## Bug Fixes

- Fix formatting issue for `Quantity` objects with zero values.
- Fix formatting isuse for `Quantity` when the base value is float.inf or float.nan.
- Fixes a bug in the ring buffer updating the end timestamp of gaps when they are outdated.

- Properly handles PV configurations with no or only some meters before the PV component.

So far we only had configurations like this: `Meter -> Inverter -> PV`. However the scenario with `Inverter -> PV` is also possible and now handled correctly.

- Fix `consumer_power()` not working certain configurations.

In microgrids without consumers and no main meter, the formula would never return any values.

- Fix `pv_power` not working in setups with 2 grid meters by using a new reliable function to search for components in the components graph

- Fix `consumer_power` and `producer_power` similar to `pv_power`

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
- Zero value requests received by the `PowerDistributingActor` will now always be accepted, even when there are non-zero exclusion bounds.
21 changes: 9 additions & 12 deletions benchmarks/power_distribution/power_distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from frequenz.sdk.actor.power_distributing import (
BatteryStatus,
Error,
OutOfBound,
OutOfBounds,
PartialFailure,
PowerDistributingActor,
Request,
Expand Down Expand Up @@ -75,7 +75,7 @@ def parse_result(result: List[List[Result]]) -> Dict[str, float]:
Error: 0,
Success: 0,
PartialFailure: 0,
OutOfBound: 0,
OutOfBounds: 0,
}

for result_list in result:
Expand All @@ -86,7 +86,7 @@ def parse_result(result: List[List[Result]]) -> Dict[str, float]:
"success_num": result_counts[Success],
"failed_num": result_counts[PartialFailure],
"error_num": result_counts[Error],
"out_of_bound": result_counts[OutOfBound],
"out_of_bounds": result_counts[OutOfBounds],
}


Expand All @@ -108,19 +108,16 @@ async def run_test( # pylint: disable=too-many-locals
power_request_channel = Broadcast[Request]("power-request")
battery_status_channel = Broadcast[BatteryStatus]("battery-status")
channel_registry = ChannelRegistry(name="power_distributor")
distributor = PowerDistributingActor(
async with PowerDistributingActor(
channel_registry=channel_registry,
requests_receiver=power_request_channel.new_receiver(),
battery_status_sender=battery_status_channel.new_sender(),
)

tasks: List[Coroutine[Any, Any, List[Result]]] = []
tasks.append(send_requests(batteries, num_requests))

result = await asyncio.gather(*tasks)
exec_time = timeit.default_timer() - start
):
tasks: List[Coroutine[Any, Any, List[Result]]] = []
tasks.append(send_requests(batteries, num_requests))

await distributor._stop() # type: ignore # pylint: disable=no-member, protected-access
result = await asyncio.gather(*tasks)
exec_time = timeit.default_timer() - start

summary = parse_result(result)
summary["num_requests"] = num_requests
Expand Down
29 changes: 14 additions & 15 deletions benchmarks/timeseries/benchmark_datasourcing.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def benchmark_data_sourcing(
num_ev_chargers * len(COMPONENT_METRIC_IDS) * num_msgs_per_battery
)
mock_grid = MockMicrogrid(
grid_side_meter=False, num_values=num_msgs_per_battery, sample_rate_s=0.0
grid_meter=False, num_values=num_msgs_per_battery, sample_rate_s=0.0
)

mock_grid.add_ev_chargers(num_ev_chargers)
Expand Down Expand Up @@ -113,23 +113,22 @@ async def consume(channel: Receiver[Any]) -> None:
await request_sender.send(request)
consume_tasks.append(asyncio.create_task(consume(recv_channel)))

DataSourcingActor(request_receiver, channel_registry)
async with DataSourcingActor(request_receiver, channel_registry):
await asyncio.gather(*consume_tasks)

await asyncio.gather(*consume_tasks)
time_taken = perf_counter() - start_time

time_taken = perf_counter() - start_time
await mock_grid.cleanup()

await mock_grid.cleanup()

print(f"Samples Sent: {samples_sent}, time taken: {time_taken}")
print(f"Samples per second: {samples_sent / time_taken}")
print(
"Expected samples: "
f"{num_expected_messages}, missing: {num_expected_messages - samples_sent}"
)
print(
f"Missing per EVC: {(num_expected_messages - samples_sent) / num_ev_chargers}"
)
print(f"Samples Sent: {samples_sent}, time taken: {time_taken}")
print(f"Samples per second: {samples_sent / time_taken}")
print(
"Expected samples: "
f"{num_expected_messages}, missing: {num_expected_messages - samples_sent}"
)
print(
f"Missing per EVC: {(num_expected_messages - samples_sent) / num_ev_chargers}"
)


def parse_args() -> Tuple[int, int, bool]:
Expand Down
Loading