MCPcopy Create free account
hub / github.com/pathwaycom/pathway / TimestampSubject

Class TimestampSubject

python/pathway/stdlib/temporal/time_utils.py:17–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16
17class TimestampSubject(io.python.ConnectorSubject):
18 _refresh_rate: datetime.timedelta
19 _initial_delay: datetime.timedelta
20
21 def __init__(
22 self, refresh_rate: datetime.timedelta, initial_delay: datetime.timedelta
23 ) -> None:
24 super().__init__()
25 self._refresh_rate = refresh_rate
26 self._initial_delay = initial_delay
27
28 @property
29 def _deletions_enabled(self) -> bool:
30 return False
31
32 def run(self) -> None:
33 time.sleep(self._initial_delay.total_seconds())
34 while True:
35 now_utc = datetime.datetime.now(tz=datetime.timezone.utc)
36 self.next(timestamp_utc=now_utc)
37 self.commit()
38 time.sleep(self._refresh_rate.total_seconds())
39
40
41@cache

Callers 1

utc_nowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected