A highlevel interface for the dispatch API
Project description
Dispatch Highlevel Interface
Introduction
A highlevel interface for the dispatch API.
See the documentation for more information.
Usage
The Dispatcher class, the main entry point for the API, provides two channels:
- Lifecycle events: A channel that sends a message whenever a [Dispatch][frequenz.dispatch.Dispatch] is created, updated or deleted.
- Running status change: Sends a dispatch message whenever a dispatch is ready to be executed according to the schedule or the running status of the dispatch changed in a way that could potentially require the actor to start, stop or reconfigure itself.
Example using the running status change channel
import os
from unittest.mock import MagicMock
from datetime import timedelta
from frequenz.dispatch import Dispatcher, DispatchInfo, MergeByType
async def create_actor(dispatch: DispatchInfo, receiver: Receiver[DispatchInfo]) -> Actor:
return MagicMock(dispatch=dispatch, receiver=receiver)
async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")
microgrid_id = 1
async with Dispatcher(
microgrid_id=microgrid_id,
server_url=url,
key=key,
) as dispatcher:
await dispatcher.start_managing(
dispatch_type="EXAMPLE_TYPE",
actor_factory=create_actor,
merge_strategy=MergeByType(),
retry_interval=timedelta(seconds=10)
)
await dispatcher
Supported Platforms
The following platforms are officially supported (tested):
- Python: 3.11
- Operating System: Ubuntu Linux 20.04
- Architectures: amd64, arm64
Contributing
If you want to know how to build this project and contribute to it, please check out the Contributing Guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frequenz_dispatch-0.8.1.tar.gz.
File metadata
- Download URL: frequenz_dispatch-0.8.1.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2c8527daeb37e0d9afb1a6eb9eb8f8897bb857606e59ab9e5213fe75cca3cf1
|
|
| MD5 |
12a12d901b158316e0045a7d71f6c897
|
|
| BLAKE2b-256 |
52d7a15d43f4a2a40605be630b63edc2ec1efb55c9339664a39f5e3f38e6a69b
|
Provenance
The following attestation bundles were made for frequenz_dispatch-0.8.1.tar.gz:
Publisher:
ci.yaml on frequenz-floss/frequenz-dispatch-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frequenz_dispatch-0.8.1.tar.gz -
Subject digest:
a2c8527daeb37e0d9afb1a6eb9eb8f8897bb857606e59ab9e5213fe75cca3cf1 - Sigstore transparency entry: 230109441
- Sigstore integration time:
-
Permalink:
frequenz-floss/frequenz-dispatch-python@0f1a52a2c185529ff71a5072a0987dd6bf96e2f6 -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/frequenz-floss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@0f1a52a2c185529ff71a5072a0987dd6bf96e2f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file frequenz_dispatch-0.8.1-py3-none-any.whl.
File metadata
- Download URL: frequenz_dispatch-0.8.1-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e50b7632791188b4081d6ce44587e83269ce2a694386d9e719723c29452456
|
|
| MD5 |
47a438427dc15ad08ef53a2e980afe21
|
|
| BLAKE2b-256 |
d15dd15d67c6dc9735b4c88286a8d79156dc969add32abeccfdb95e092ecfd27
|
Provenance
The following attestation bundles were made for frequenz_dispatch-0.8.1-py3-none-any.whl:
Publisher:
ci.yaml on frequenz-floss/frequenz-dispatch-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frequenz_dispatch-0.8.1-py3-none-any.whl -
Subject digest:
56e50b7632791188b4081d6ce44587e83269ce2a694386d9e719723c29452456 - Sigstore transparency entry: 230109442
- Sigstore integration time:
-
Permalink:
frequenz-floss/frequenz-dispatch-python@0f1a52a2c185529ff71a5072a0987dd6bf96e2f6 -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/frequenz-floss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@0f1a52a2c185529ff71a5072a0987dd6bf96e2f6 -
Trigger Event:
push
-
Statement type: