Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevent timing issues by sleeping before reporting metrics #78

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion judoscale/core/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ def pid(self) -> int:

def _run_loop(self):
while self.is_running:
self._report_metrics()
# NOTE: we used to report metrics immediately after the process
# started, but this caused issues with Celery and Celery Beat
# when TRACK_BUSY_JOBS was enabled.
# Instead, we now wait for the first interval to pass before
# reporting metrics.
time.sleep(self.config["REPORT_INTERVAL_SECONDS"])
self._report_metrics()

if self._stopevent.is_set():
break
Expand Down