types
frequenz.client.dispatch.types ¤
Type wrappers for the generated protobuf messages.
Attributes¤
frequenz.client.dispatch.types.TargetComponents
module-attribute
¤
One or more target components specifying which components a dispatch targets.
It 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
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 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 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 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 |
|
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 | None
The duration of the dispatch, represented as a timedelta.
next_run
property
¤
next_run: datetime | None
Calculate the next run of a dispatch.
RETURNS | DESCRIPTION |
---|---|
datetime | None
|
The next run of the dispatch or None if the dispatch is finished. |
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.
started
property
¤
started: bool
Check if the dispatch has started.
A dispatch is considered started if the current time is after the start time but before the end time.
Recurring dispatches are considered started if the current time is after the start time of the last occurrence but before the end time of the last occurrence.
type
instance-attribute
¤
type: str
User-defined information about the type of dispatch.
This is understood and processed by downstream applications.
until
property
¤
until: datetime | None
Time when the dispatch should end.
Returns the time that a running dispatch should end. If the dispatch is not running, None is returned.
RETURNS | DESCRIPTION |
---|---|
datetime | None
|
The time when the dispatch should end or None if the dispatch is not running. |
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
next_run_after ¤
Calculate the next run of a dispatch.
PARAMETER | DESCRIPTION |
---|---|
after
|
The time to calculate the next run from.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
datetime | None
|
The next run of the dispatch or None if the dispatch is finished. |
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.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.TimeIntervalFilter
dataclass
¤
Filter for a time interval.