Skip to content

Conversation

rkuo-danswer
Copy link
Contributor

Description

Fixes https://linear.app/danswer/issue/DAN-2007/k8s-probes-for-celery-beat

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

Copy link

vercel bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 9:56pm

@rkuo-danswer rkuo-danswer marked this pull request as ready for review May 22, 2025 21:53
@rkuo-danswer rkuo-danswer requested a review from a team as a code owner May 22, 2025 21:53
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR implements Kubernetes health monitoring for Celery Beat and workers through file-based liveness and readiness probes.

  • Added make_probe_path in celery_utils.py to generate standardized probe file paths with hostname validation
  • Implemented liveness probe in beat.py that updates during scheduler ticks and readiness probe after Redis initialization
  • Added LivenessProbe bootstep class in app_base.py for periodic worker health checks
  • Probe files are managed in /tmp with proper cleanup on worker shutdown
  • Consider adding error handling for probe file operations in case of filesystem issues

3 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 349 to 352
hostname: str = cast(str, sender.hostname)
path = _make_probe_path("readiness", hostname)
path = make_probe_path("readiness", hostname)
path.touch()
logger.info(f"Readiness signal touched at {path}.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Similar to liveness probe, readiness probe should handle potential IOErrors when touching the file

Suggested change
hostname: str = cast(str, sender.hostname)
path = _make_probe_path("readiness", hostname)
path = make_probe_path("readiness", hostname)
path.touch()
logger.info(f"Readiness signal touched at {path}.")
hostname: str = cast(str, sender.hostname)
path = make_probe_path("readiness", hostname)
try:
path.touch()
logger.info(f"Readiness signal touched at {path}.")
except IOError:
logger.exception(f"Failed to create readiness probe file at {path}")

@rkuo-danswer rkuo-danswer added this pull request to the merge queue May 23, 2025
Merged via the queue into main with commit b824951 May 23, 2025
11 checks passed
@rkuo-danswer rkuo-danswer deleted the bugfix/k8s-probes-2 branch May 23, 2025 02:40
ferdinandl007 pushed a commit to ferdinandl007/onyx that referenced this pull request May 27, 2025
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
aronszanto pushed a commit to aronszanto/onyx that referenced this pull request May 27, 2025
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
ZhipengHe pushed a commit to ZhipengHe/onyx that referenced this pull request Jun 6, 2025
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants