rohdesamuel commented on code in PR #28273:
URL: https://github.com/apache/beam/pull/28273#discussion_r1315997391
##########
sdks/python/apache_beam/runners/worker/data_sampler.py:
##########
@@ -49,11 +49,19 @@
class SampleTimer:
"""Periodic timer for sampling elements."""
def __init__(self, timeout_secs: float, sampler: OutputSampler) -> None:
- self._timeout_secs = timeout_secs
+ self._target_timeout_secs = timeout_secs
+ self._timeout_secs = min(timeout_secs, 0.5) if timeout_secs > 0 else 0
self._timer = Timer(self._timeout_secs, self.sample)
self._sampler = sampler
+ self._sample_duration_secs = 0
def reset(self) -> None:
+ # For the first 30 seconds, sample every 0.5 seconds. After that, sample at
+ # the normal rate.
+ if self._sample_duration_secs >= 30:
Review Comment:
Not necessarily, though it seems similar. The logic is there to increase
resolution at the beginning to more quickly bring samples to the user. The
target_timeout_secs is there only to remember what the original timeout is to
set later on.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]