File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/frequenz/client/microgrid/component Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 44"""Component connection."""
55
66import dataclasses
7+ from datetime import datetime , timezone
78from functools import cached_property
89
910from .._id import ComponentId
@@ -58,10 +59,14 @@ def __post_init__(self) -> None:
5859 if self .source == self .destination :
5960 raise ValueError ("Source and destination components must be different" )
6061
62+ def active_at (self , timestamp : datetime ) -> bool :
63+ """Check whether this connection is active at a specific timestamp."""
64+ return self .operational_lifetime .active_at (timestamp )
65+
6166 @cached_property
6267 def active (self ) -> bool :
6368 """Whether this connection is currently active."""
64- return self .operational_lifetime . active
69+ return self .active_at ( datetime . now ( timezone . utc ))
6570
6671 def __str__ (self ) -> str :
6772 """Return a human-readable string representation of this instance."""
You can’t perform that action at this time.
0 commit comments