Skip to content

Commit

Permalink
[doc] compile api annotation check into single job
Browse files Browse the repository at this point in the history
this avoids building the ray wheel for many times

Signed-off-by: Lonnie Liu <[email protected]>
  • Loading branch information
aslonnie committed Feb 8, 2025
1 parent 9b5691b commit 0d56d17
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
7 changes: 1 addition & 6 deletions .buildkite/lint.rayci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ steps:
- ./ci/lint/lint.sh {{matrix}}
matrix:
- api_annotations
- api_policy_check core
- api_policy_check serve
- api_policy_check data
- api_policy_check train
- api_policy_check tune
- api_policy_check rllib
- api_policy_check

- label: ":lint-roller: lint: linkcheck"
instance_type: medium
Expand Down
1 change: 1 addition & 0 deletions ci/lint/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ api_policy_check() {
# install ray and compile doc to generate API files
make -C doc/ html
RAY_DISABLE_EXTRA_CPP=1 pip install -e "python[all]"

# validate the API files
bazel run //ci/ray_ci/doc:cmd_check_api_discrepancy -- /ray "$@"
}
Expand Down
40 changes: 29 additions & 11 deletions ci/ray_ci/doc/cmd_check_api_discrepancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,7 @@
}


@click.command()
@click.argument("ray_checkout_dir", required=True, type=str)
@click.argument("team", required=True, type=click.Choice(list(TEAM_API_CONFIGS.keys())))
def main(ray_checkout_dir: str, team: str) -> None:
"""
This script checks for annotated classes and functions in a module, and finds
discrepancies between the annotations and the documentation.
"""

def _check_team(ray_checkout_dir: str, team: str) -> bool:
# Load all APIs from the codebase
api_in_codes = {}
for module in TEAM_API_CONFIGS[team]["head_modules"]:
Expand Down Expand Up @@ -103,9 +95,35 @@ def main(ray_checkout_dir: str, team: str) -> None:
for api in bad_apis:
logger.info(f"\t{api}")

assert not bad_apis, "Some public APIs are not documented. Please document them."
if not bad_apis:
logger.info(
f"Some public {team} APIs are not documented. Please document them."
)
return False
return True


@click.command()
@click.argument("ray_checkout_dir", required=True, type=str)
@click.argument(
"team", default="ALL", type=click.Choice(list(TEAM_API_CONFIGS.keys()) + ["ALL"])
)
def main(ray_checkout_dir: str, team: str) -> None:
"""
This script checks for annotated classes and functions in a module, and finds
discrepancies between the annotations and the documentation.
"""
if team != "ALL":
if not _check_team(ray_checkout_dir, team):
exit(1)
return

return
all_pass = True
for team in TEAM_API_CONFIGS:
if not _check_team(ray_checkout_dir, team):
all_pass = False
if not all_pass:
exit(1)


if __name__ == "__main__":
Expand Down

0 comments on commit 0d56d17

Please sign in to comment.