-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Jobs] [Doc] Add Jobs openapi spec and REST API documentation #30417
[Jobs] [Doc] Add Jobs openapi spec and REST API documentation #30417
Conversation
Signed-off-by: Archit Kulkarni <[email protected]>
Signed-off-by: Archit Kulkarni <[email protected]>
Signed-off-by: Archit Kulkarni <[email protected]>
Signed-off-by: Archit Kulkarni <[email protected]>
Signed-off-by: Archit Kulkarni <[email protected]>
openapi: 3.1.0 | ||
info: | ||
title: Ray Jobs API | ||
version: 4.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The /api/version
returns "4"
, not "4.0.0"
. Do these need to be kept in sync?
@@ -59,6 +59,7 @@ sphinxcontrib.yt==0.2.2 | |||
sphinx-sitemap==2.2.0 | |||
sphinx-thebe==0.1.1 | |||
autodoc_pydantic==1.6.1 | |||
sphinxcontrib-redoc==1.6.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a particular reason to pin the version here, just following what's been done for other sphinx extensions
@architkulkarni re: the process to generate the documentation, at a minimum we need to document how to do this in case others make changes in the future. Could you add a short README somewhere in the code? |
This is fantastic though! |
Signed-off-by: Archit Kulkarni <[email protected]>
Signed-off-by: Archit Kulkarni <[email protected]>
@edoakes Good point, I added a note to |
dashboard/modules/job/job_head.py
Outdated
NOTE(architkulkarni): Please keep this class in sync with the OpenAPI spec at | ||
`doc/source/cluster/running-applications/job-submission/openapi.yml`. | ||
We currently do not automatically check that the OpenAPI | ||
spec is in sync with the implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't know how to do this from the description alone, can you include instructions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edoakes updated, let me know if any parts are unclear
Signed-off-by: Archit Kulkarni <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to get a review from @alanwguo before merging
@@ -0,0 +1,471 @@ | |||
openapi: 3.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this file manually written? Did we consider switching the jobs api to use fast-api which has the ability to automatically generate openapi spec from the route definitions?
@rkooo567 and I have been chatting about doing a fast-api migration in the next 6 months so that we can have openapi specs for all of our APIs. If we are to do that, there's a chance that this spec will be slightly modified because it's generated instead of manually written. Will that be disruptive to users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alanwguo Yeah, migrating Jobs to FastAPI makes sense as the long term plan, we just didn't have time to do it for Ray 2.2. I think by marking the OpenAPI section of the doc as "Beta" as it currently is marked this PR, it should be okay if there are slight modifications in the future. The underlying API is stable and once we migrate to FastAPI we can mark the OpenAPI doc as "stable" as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nits. You can incorporate them if they make sense or add clarity. LGTM
paths in the @route decorators or in the Responses returned by the | ||
methods (or any nested fields in the Responses), you will need to find the | ||
corresponding field of the OpenAPI yaml file and update it manually, and | ||
bump the version number in the yaml file and in this class's `get_version`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence is long. I would break it.
"update it manually." Also, bump the version number in the yaml file and in this class's get_version
.
summary: | | ||
Get Version | ||
description: | | ||
Get the Ray Jobs API version and the Ray version running on the cluster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use possessive here? Ray Jobs' API? If so then change in all description below.
I guess this would be tantamount to asking "Get Python's version" or "Get Python version."
I think either would work. But a grammar pedantic would suggest otherwise.
type: object | ||
properties: | ||
version: | ||
description: The version of the Ray Jobs API running on the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which one reads declaratively:
"The version of the Ray Jobs API running on the server." or
"Ray Jobs' API version running on the server."
- name: submission_id | ||
in: path | ||
description: | | ||
The ID of the job to tail the logs of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ending with a proposition could read awkward in some cases. Would this be simpler: "Tail job ID's logs."
title: Job Id | ||
description: >- | ||
The job id. An id that is created for every job that is launched in ray. | ||
This can be used to fetch data about jobs using ray core apis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
launched in Ray.
title: Job Id | ||
description: >- | ||
The job id. An id that is created for every job that is launched in ray. | ||
This can be used to fetch data about jobs using ray core apis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can --> This id can be used to ...
title: Submission Id | ||
description: >- | ||
A submission id is an id created for every submission job. It can be used | ||
to fetch data about jobs using the job submission apis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The antecedent is ambiguous here. Does it refer to id or job. It normally refers to the last antecedent, which is job, and that is incorrect.
Suggest use "This id can be used to fetch ...
Thanks @dmatrix, I will incorporate these in a follow-up PR! |
…oject#30417) Adds an OpenAPI spec for the Jobs REST API Adds an API doc page using Redoc. Signed-off-by: Weichen Xu <[email protected]>
Why are these changes needed?
The spec was generated via a combination of pydantic automatic schema generation, github copilot, and manual entry, but this won't be maintainable in the long term. When we move the dashboard server to FastAPI, this spec can be automatically generated.
Link to the doc page built from this PR: https://ray--30417.org.readthedocs.build/en/30417/cluster/running-applications/job-submission/rest.html
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.