Skip to content

Commit

Permalink
[State CLI] Improve the error message when an ID is missing for the `…
Browse files Browse the repository at this point in the history
…ray get` command (#43649)


---------

Signed-off-by: kaihsun <[email protected]>
  • Loading branch information
kevin85421 committed Mar 5, 2024
1 parent 51f240b commit 8900672
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/ray/util/state/state_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ def _should_explain(format: AvailableFormat) -> bool:
@click.argument(
"id",
type=str,
required=False,
)
@address_option
@timeout_option
Expand Down Expand Up @@ -398,6 +399,11 @@ def ray_get(
:class:`RayStateApiException <ray.util.state.exception.RayStateApiException>`
if the CLI is failed to query the data.
""" # noqa: E501
if not id:
raise click.BadParameter(
f"Missing argument 'ID'. Do you mean 'ray list {resource}'?"
)

# All resource names use '_' rather than '-'. But users options have '-'
resource = StateResource(resource.replace("-", "_"))

Expand Down

0 comments on commit 8900672

Please sign in to comment.