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

feat(api): add /health endpoint to check workers #345

Merged
merged 3 commits into from
Jan 23, 2024
Merged

Conversation

matthiasschaub
Copy link
Collaborator

No description provided.

@matthiasschaub matthiasschaub added this to the Release 1.2.0 milestone Jan 17, 2024
@matthiasschaub matthiasschaub requested review from jlink and removed request for joker234 January 17, 2024 11:53
jlink
jlink previously approved these changes Jan 17, 2024
Copy link

@jlink jlink left a comment

Choose a reason for hiding this comment

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

As far as I understand celery and flask, it looks alright to me. Since this is an additional endpoint, it shouldn't break anything else, even if there is a bug in the code.

result: list = celery_app.control.ping(timeout=1)
if result:
return {"status": "ok"}
return {"status": "fail"}
Copy link
Member

Choose a reason for hiding this comment

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

I think this still returns a 2xx status code. Is this on purpose?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its on purpose. I do not know of any good alternative. The endpoint did what it is supposed to do, check the celery worker and reports on it.
I think it is fine like this.

@@ -220,6 +220,15 @@ def download(uuid: str, type_: REQUEST_TYPES) -> Response:
return send_file(file, mimetype, download_name=download_name)


@app.route("/api/ping")
Copy link
Member

Choose a reason for hiding this comment

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

Is ping the term you want to use? I often saw health or maybe status as endpoint name. The term ping also refers to ICMP requests and not necessarily to TCP/QUIC requests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

/status is already in use for querying the status of a certain task (e.g. map generation). /health I like but seems to encompass more than one ping to on part of the system. On the other hand, one can add new parts to the health endpoint over time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

renamed to /health

@joker234 joker234 changed the title feat(api): add /ping endpoint to check workers feat(api): add /health endpoint to check workers Jan 22, 2024
@matthiasschaub matthiasschaub merged commit f83baf5 into main Jan 23, 2024
1 check passed
@matthiasschaub matthiasschaub deleted the healtcheck branch January 23, 2024 12:33
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.

None yet

3 participants