Skip to content

Commit

Permalink
Remove methods that were moved to client repo (#82)
Browse files Browse the repository at this point in the history
The PR looks large, but most commits are just small changes. Tried to
keep it well separated.
  • Loading branch information
Marenz authored Dec 4, 2024
2 parents 0b31c4b + cca1cc8 commit a3351f8
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 338 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
env:
NOX_SESSION: ${{ matrix.nox-session }}
run: nox -R -e "$NOX_SESSION"
timeout-minutes: 10
timeout-minutes: 2

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

# This ensures that the runner has access to the pip cache.
- name: Reset pip cache ownership
Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The [`Dispatcher` class](https://frequenz-floss.github.io/frequenz-dispatch-pyth

```python
import os
from frequenz.dispatch import Dispatcher, RunningState
from frequenz.dispatch import Dispatcher
from unittest.mock import MagicMock

async def run():
Expand All @@ -42,29 +42,29 @@ async def run():
changed_running_status_rx = dispatcher.running_status_change.new_receiver()

async for dispatch in changed_running_status_rx:
match dispatch.running("DEMO_TYPE"):
case RunningState.RUNNING:
print(f"Executing dispatch {dispatch.id}, due on {dispatch.start_time}")
if actor.is_running:
actor.reconfigure(
components=dispatch.target,
run_parameters=dispatch.payload, # custom actor parameters
dry_run=dispatch.dry_run,
until=dispatch.until,
) # this will reconfigure the actor
else:
# this will start a new actor with the given components
# and run it for the duration of the dispatch
actor.start(
components=dispatch.target,
run_parameters=dispatch.payload, # custom actor parameters
dry_run=dispatch.dry_run,
until=dispatch.until,
)
case RunningState.STOPPED:
actor.stop() # this will stop the actor
case RunningState.DIFFERENT_TYPE:
pass # dispatch not for this type
if dispatch.type != "MY_TYPE":
continue

if dispatch.started:
print(f"Executing dispatch {dispatch.id}, due on {dispatch.start_time}")
if actor.is_running:
actor.reconfigure(
components=dispatch.target,
run_parameters=dispatch.payload, # custom actor parameters
dry_run=dispatch.dry_run,
until=dispatch.until,
) # this will reconfigure the actor
else:
# this will start a new actor with the given components
# and run it for the duration of the dispatch
actor.start(
components=dispatch.target,
run_parameters=dispatch.payload, # custom actor parameters
dry_run=dispatch.dry_run,
until=dispatch.until,
)
else:
actor.stop() # this will stop the actor
```

## Supported Platforms
Expand Down
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Upgrading

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

## New Features

Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ classifiers = [
]
requires-python = ">= 3.11, < 4"
dependencies = [
"python-dateutil >= 2.8.2, < 3.0",
"typing-extensions >= 4.11.0, < 5.0.0",
# Make sure to update the version for cross-referencing also in the
# mkdocs.yml file when changing the version here (look for the config key
Expand Down Expand Up @@ -72,9 +71,9 @@ dev-mkdocs = [
]
dev-mypy = [
"mypy == 1.13.0",
"grpc-stubs == 1.53.0.5", # This dependency introduces breaking changes in patch releases
# This dependency introduces breaking changes in patch releases
"grpc-stubs == 1.53.0.5",
"types-Markdown == 3.7.0.20240822",
"types-python-dateutil==2.9.0.20241003",
# For checking the noxfile, docs/ script, and tests
"frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
]
Expand Down
3 changes: 1 addition & 2 deletions src/frequenz/dispatch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

from ._dispatch import Dispatch, RunningState
from ._dispatch import Dispatch
from ._dispatcher import Dispatcher, ReceiverFetcher
from ._event import Created, Deleted, DispatchEvent, Updated
from ._managing_actor import DispatchManagingActor, DispatchUpdate
Expand All @@ -28,7 +28,6 @@
"ReceiverFetcher",
"Updated",
"Dispatch",
"RunningState",
"DispatchManagingActor",
"DispatchUpdate",
]
Loading

0 comments on commit a3351f8

Please sign in to comment.