From 40db73d4f263aa104878df8dd1a7fb62aa9ed1da Mon Sep 17 00:00:00 2001 From: nhquana2 Date: Sat, 18 Apr 2026 23:28:16 +0700 Subject: [PATCH 1/3] [core] Group observability APIs in ray CLI help output Fixes an issue where 'get' and 'list' APIs were mixed up with standard commands under 'ray --help'. By implementing a custom click.Group (RayCLI), we now strictly segregate the State CLI commands (get, list, summary, logs) into a dedicated 'Observability:' section to improve discoverability. Signed-off-by: nhquana2 --- python/ray/scripts/scripts.py | 42 ++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/python/ray/scripts/scripts.py b/python/ray/scripts/scripts.py index 4dd9e049834b..59694e430242 100644 --- a/python/ray/scripts/scripts.py +++ b/python/ray/scripts/scripts.py @@ -142,7 +142,47 @@ def _check_ray_version(gcs_client): ) -@click.group() +class RayCLI(click.Group): + def format_commands(self, ctx, formatter): + commands = [] + for subcommand in self.list_commands(ctx): + cmd = self.get_command(ctx, subcommand) + if cmd is None: + continue + if cmd.hidden: + continue + commands.append((subcommand, cmd)) + + if len(commands): + limit = formatter.width - 6 - max(len(cmd[0]) for cmd in commands) + + observability_commands = [] + other_commands = [] + + observability_names = { + "summary", + "list", + "get", + "logs", + } + + for subcommand, cmd in commands: + help = cmd.get_short_help_str(limit) + if subcommand in observability_names: + observability_commands.append((subcommand, help)) + else: + other_commands.append((subcommand, help)) + + if other_commands: + with formatter.section("Commands"): + formatter.write_dl(other_commands) + + if observability_commands: + with formatter.section("Observability"): + formatter.write_dl(observability_commands) + + +@click.group(cls=RayCLI) @click.option( "--logging-level", required=False, From 11021fbfb99cf9ac60f37e1921787d1542bb7fce Mon Sep 17 00:00:00 2001 From: nhquana2 Date: Sun, 19 Apr 2026 22:17:42 +0700 Subject: [PATCH 2/3] Trigger CI Signed-off-by: nhquana2 From 838e38222f46a59b93cd6f2457019f341f6fedaf Mon Sep 17 00:00:00 2001 From: nhquana2 Date: Mon, 20 Apr 2026 09:17:51 +0700 Subject: [PATCH 3/3] [core] RayCLI class docstring update for better clarity Signed-off-by: nhquana2 --- python/ray/scripts/scripts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/ray/scripts/scripts.py b/python/ray/scripts/scripts.py index 59694e430242..9a9a9e57d89f 100644 --- a/python/ray/scripts/scripts.py +++ b/python/ray/scripts/scripts.py @@ -143,6 +143,12 @@ def _check_ray_version(gcs_client): class RayCLI(click.Group): + """Custom click.Group that groups observability commands (State CLI commands) in help output. + + This overrides format_commands to split subcommands into "Observability" + and "Commands" sections for better readability of ray --help output. + """ + def format_commands(self, ctx, formatter): commands = [] for subcommand in self.list_commands(ctx):