types
frequenz.client.dispatch.types ¤
Type wrappers for the generated protobuf messages.
Attributes¤
frequenz.client.dispatch.types.ComponentSelector
module-attribute
¤
A component selector specifying which components a dispatch targets.
A component selector can be a list of component IDs or a list of categories.
Classes¤
frequenz.client.dispatch.types.Dispatch
dataclass
¤
Represents a dispatch operation within a microgrid system.
Source code in frequenz/client/dispatch/types.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
|
Attributes¤
active
instance-attribute
¤
active: bool
Indicates whether the dispatch is active and eligible for processing.
create_time
instance-attribute
¤
create_time: datetime
The creation time of the dispatch in UTC. Set when a dispatch is created.
dry_run
instance-attribute
¤
dry_run: bool
Indicates if the dispatch is a dry run.
Executed for logging and monitoring without affecting actual component states.
duration
instance-attribute
¤
duration: timedelta
The duration of the dispatch, represented as a timedelta.
payload
instance-attribute
¤
The dispatch payload containing arbitrary data.
It is structured as needed for the dispatch operation.
recurrence
instance-attribute
¤
recurrence: RecurrenceRule
The recurrence rule for the dispatch.
Defining any repeating patterns or schedules.
selector
instance-attribute
¤
selector: ComponentSelector
The component selector specifying which components the dispatch targets.
type
instance-attribute
¤
type: str
User-defined information about the type of dispatch.
This is understood and processed by downstream applications.
update_time
instance-attribute
¤
update_time: datetime
The last update time of the dispatch in UTC. Set when a dispatch is modified.
Functions¤
from_protobuf
classmethod
¤
Convert a protobuf dispatch to a dispatch.
PARAMETER | DESCRIPTION |
---|---|
pb_object |
The protobuf dispatch to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Dispatch
|
The converted dispatch. |
Source code in frequenz/client/dispatch/types.py
to_protobuf ¤
to_protobuf() -> Dispatch
Convert a dispatch to a protobuf dispatch.
RETURNS | DESCRIPTION |
---|---|
Dispatch
|
The converted protobuf dispatch. |
Source code in frequenz/client/dispatch/types.py
frequenz.client.dispatch.types.DispatchEvent
dataclass
¤
Represents an event that occurred during a dispatch operation.
Source code in frequenz/client/dispatch/types.py
Attributes¤
Functions¤
from_protobuf
classmethod
¤
from_protobuf(
pb_object: StreamMicrogridDispatchesResponse,
) -> DispatchEvent
Convert a protobuf dispatch event to a dispatch event.
PARAMETER | DESCRIPTION |
---|---|
pb_object |
The protobuf dispatch event to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DispatchEvent
|
The converted dispatch event. |
Source code in frequenz/client/dispatch/types.py
frequenz.client.dispatch.types.EndCriteria
dataclass
¤
Controls when a recurring dispatch should end.
Source code in frequenz/client/dispatch/types.py
Attributes¤
count
class-attribute
instance-attribute
¤
count: int | None = None
The number of times this dispatch should recur.
until
class-attribute
instance-attribute
¤
until: datetime | None = None
The end time of this dispatch in UTC.
Functions¤
from_protobuf
classmethod
¤
from_protobuf(pb_criteria: EndCriteria) -> EndCriteria
Convert a protobuf end criteria to an end criteria.
PARAMETER | DESCRIPTION |
---|---|
pb_criteria |
The protobuf end criteria to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
EndCriteria
|
The converted end criteria. |
Source code in frequenz/client/dispatch/types.py
to_protobuf ¤
to_protobuf() -> EndCriteria
Convert an end criteria to a protobuf end criteria.
RETURNS | DESCRIPTION |
---|---|
EndCriteria
|
The converted protobuf end criteria. |
Source code in frequenz/client/dispatch/types.py
frequenz.client.dispatch.types.Event ¤
Bases: IntEnum
Enum representing the type of event that occurred during a dispatch operation.
Source code in frequenz/client/dispatch/types.py
frequenz.client.dispatch.types.Frequency ¤
Bases: IntEnum
Enum representing the frequency of the recurrence.
Source code in frequenz/client/dispatch/types.py
frequenz.client.dispatch.types.RecurrenceRule
dataclass
¤
Ruleset governing when and how a dispatch should re-occur.
Attributes follow the iCalendar specification (RFC5545) for recurrence rules.
Source code in frequenz/client/dispatch/types.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
Attributes¤
byhours
class-attribute
instance-attribute
¤
On which hour(s) of the day the event occurs.
byminutes
class-attribute
instance-attribute
¤
On which minute(s) of the hour the event occurs.
bymonthdays
class-attribute
instance-attribute
¤
On which day(s) of the month the event occurs.
bymonths
class-attribute
instance-attribute
¤
On which month(s) of the year the event occurs.
byweekdays
class-attribute
instance-attribute
¤
On which day(s) of the week the event occurs.
end_criteria
class-attribute
instance-attribute
¤
end_criteria: EndCriteria | None = None
When this dispatch should end.
Can recur a fixed number of times or until a given timestamp.
frequency
class-attribute
instance-attribute
¤
frequency: Frequency = UNSPECIFIED
The frequency specifier of this recurring dispatch.
interval
class-attribute
instance-attribute
¤
interval: int = 0
How often this dispatch should recur, based on the frequency.
Functions¤
from_protobuf
classmethod
¤
from_protobuf(pb_rule: RecurrenceRule) -> RecurrenceRule
Convert a protobuf recurrence rule to a recurrence rule.
PARAMETER | DESCRIPTION |
---|---|
pb_rule |
The protobuf recurrence rule to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RecurrenceRule
|
The converted recurrence rule. |
Source code in frequenz/client/dispatch/types.py
to_protobuf ¤
to_protobuf() -> RecurrenceRule
Convert a recurrence rule to a protobuf recurrence rule.
RETURNS | DESCRIPTION |
---|---|
RecurrenceRule
|
The converted protobuf recurrence rule. |
Source code in frequenz/client/dispatch/types.py
frequenz.client.dispatch.types.TimeIntervalFilter
dataclass
¤
Filter for a time interval.
Source code in frequenz/client/dispatch/types.py
Attributes¤
frequenz.client.dispatch.types.Weekday ¤
Bases: IntEnum
Enum representing the day of the week.
Source code in frequenz/client/dispatch/types.py
Functions¤
frequenz.client.dispatch.types.component_selector_from_protobuf ¤
component_selector_from_protobuf(
pb_selector: ComponentSelector,
) -> ComponentSelector
Convert a protobuf component selector to a component selector.
PARAMETER | DESCRIPTION |
---|---|
pb_selector |
The protobuf component selector to convert.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the protobuf component selector is invalid. |
RETURNS | DESCRIPTION |
---|---|
ComponentSelector
|
The converted component selector. |
Source code in frequenz/client/dispatch/types.py
frequenz.client.dispatch.types.component_selector_to_protobuf ¤
component_selector_to_protobuf(
selector: ComponentSelector,
) -> ComponentSelector
Convert a component selector to a protobuf component selector.
PARAMETER | DESCRIPTION |
---|---|
selector |
The component selector to convert.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the component selector is invalid. |
RETURNS | DESCRIPTION |
---|---|
ComponentSelector
|
The converted protobuf component selector. |