Skip to content

Commit 4220f2c

Browse files
authored
Remove methods that were moved to client repo (#82)
The PR looks large, but most commits are just small changes. Tried to keep it well separated.
2 parents 0b31c4b + 4b63715 commit 4220f2c

File tree

10 files changed

+113
-338
lines changed

10 files changed

+113
-338
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
env:
7979
NOX_SESSION: ${{ matrix.nox-session }}
8080
run: nox -R -e "$NOX_SESSION"
81-
timeout-minutes: 10
81+
timeout-minutes: 2
8282

8383
# This job runs if all the `nox` matrix jobs ran and succeeded.
8484
# It is only used to have a single job that we can require in branch
@@ -185,7 +185,7 @@ jobs:
185185
--platform linux/${{ matrix.arch }} \
186186
localhost/nox-cross-arch:latest \
187187
bash -c "pip install -e .[dev-noxfile]; nox --install-only -e ${{ matrix.nox-session }}; pip freeze; nox -R -e ${{ matrix.nox-session }}"
188-
timeout-minutes: 30
188+
timeout-minutes: 6
189189

190190
# This ensures that the runner has access to the pip cache.
191191
- name: Reset pip cache ownership

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The [`Dispatcher` class](https://frequenz-floss.github.io/frequenz-dispatch-pyth
2121

2222
```python
2323
import os
24-
from frequenz.dispatch import Dispatcher, RunningState
24+
from frequenz.dispatch import Dispatcher
2525
from unittest.mock import MagicMock
2626

2727
async def run():
@@ -42,29 +42,29 @@ async def run():
4242
changed_running_status_rx = dispatcher.running_status_change.new_receiver()
4343

4444
async for dispatch in changed_running_status_rx:
45-
match dispatch.running("DEMO_TYPE"):
46-
case RunningState.RUNNING:
47-
print(f"Executing dispatch {dispatch.id}, due on {dispatch.start_time}")
48-
if actor.is_running:
49-
actor.reconfigure(
50-
components=dispatch.target,
51-
run_parameters=dispatch.payload, # custom actor parameters
52-
dry_run=dispatch.dry_run,
53-
until=dispatch.until,
54-
) # this will reconfigure the actor
55-
else:
56-
# this will start a new actor with the given components
57-
# and run it for the duration of the dispatch
58-
actor.start(
59-
components=dispatch.target,
60-
run_parameters=dispatch.payload, # custom actor parameters
61-
dry_run=dispatch.dry_run,
62-
until=dispatch.until,
63-
)
64-
case RunningState.STOPPED:
65-
actor.stop() # this will stop the actor
66-
case RunningState.DIFFERENT_TYPE:
67-
pass # dispatch not for this type
45+
if dispatch.type != "MY_TYPE":
46+
continue
47+
48+
if dispatch.started:
49+
print(f"Executing dispatch {dispatch.id}, due on {dispatch.start_time}")
50+
if actor.is_running:
51+
actor.reconfigure(
52+
components=dispatch.target,
53+
run_parameters=dispatch.payload, # custom actor parameters
54+
dry_run=dispatch.dry_run,
55+
until=dispatch.until,
56+
) # this will reconfigure the actor
57+
else:
58+
# this will start a new actor with the given components
59+
# and run it for the duration of the dispatch
60+
actor.start(
61+
components=dispatch.target,
62+
run_parameters=dispatch.payload, # custom actor parameters
63+
dry_run=dispatch.dry_run,
64+
until=dispatch.until,
65+
)
66+
else:
67+
actor.stop() # this will stop the actor
6868
```
6969

7070
## Supported Platforms

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
* The method `Dispatch.running(type: str)` was replaced with the property `Dispatch.started: bool`.
1010

1111
## New Features
1212

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ classifiers = [
3434
]
3535
requires-python = ">= 3.11, < 4"
3636
dependencies = [
37-
"python-dateutil >= 2.8.2, < 3.0",
3837
"typing-extensions >= 4.11.0, < 5.0.0",
3938
# Make sure to update the version for cross-referencing also in the
4039
# mkdocs.yml file when changing the version here (look for the config key
@@ -72,9 +71,9 @@ dev-mkdocs = [
7271
]
7372
dev-mypy = [
7473
"mypy == 1.13.0",
75-
"grpc-stubs == 1.53.0.5", # This dependency introduces breaking changes in patch releases
74+
# This dependency introduces breaking changes in patch releases
75+
"grpc-stubs == 1.53.0.5",
7676
"types-Markdown == 3.7.0.20240822",
77-
"types-python-dateutil==2.9.0.20241003",
7877
# For checking the noxfile, docs/ script, and tests
7978
"frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
8079
]

src/frequenz/dispatch/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
"""
1717

18-
from ._dispatch import Dispatch, RunningState
18+
from ._dispatch import Dispatch
1919
from ._dispatcher import Dispatcher, ReceiverFetcher
2020
from ._event import Created, Deleted, DispatchEvent, Updated
2121
from ._managing_actor import DispatchManagingActor, DispatchUpdate
@@ -28,7 +28,6 @@
2828
"ReceiverFetcher",
2929
"Updated",
3030
"Dispatch",
31-
"RunningState",
3231
"DispatchManagingActor",
3332
"DispatchUpdate",
3433
]

0 commit comments

Comments
 (0)