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][kubectl-plugin] list Ray nodes #3007

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

davidxia
Copy link
Contributor

@davidxia davidxia commented Feb 11, 2025

with

kubectl ray (get|list) node[s] (NODE_NAME) \
  [(-c/--ray-cluster) RAYCLUSTER] [(-n/--namespace) NAMESPACE] [(-A/--all-namespaces)]

This idea was originally described in this doc.

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@davidxia davidxia force-pushed the get-nodes branch 2 times, most recently from f083cc9 to d6c0fd5 Compare February 11, 2025 19:53
kubectl-plugin/pkg/cmd/get/get_nodes.go Outdated Show resolved Hide resolved
kubectl-plugin/pkg/cmd/get/get_nodes.go Outdated Show resolved Hide resolved
@davidxia davidxia force-pushed the get-nodes branch 4 times, most recently from a224f32 to 1405b6f Compare February 12, 2025 13:00
@davidxia davidxia marked this pull request as ready for review February 12, 2025 15:34
@andrewsykim
Copy link
Collaborator

Overall LGTM, @chiayi can you take a look too please?

Copy link
Contributor

@chiayi chiayi left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@andrewsykim andrewsykim left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor comments

memory resource.Quantity
namespace string
cluster string
_type string
Copy link
Collaborator

Choose a reason for hiding this comment

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

why the underscore on this field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

type is a reserved keyword in Go. Lmk if there's a better name or convention.

kubectl-plugin/pkg/cmd/get/get_nodes.go Outdated Show resolved Hide resolved
@@ -0,0 +1,3 @@
NAMESPACE NAME CPUS GPUS TPUS MEMORY CLUSTER WORKER GROUP AGE
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason for this result not having type column?

@@ -0,0 +1,2 @@
NAMESPACE NAME CPUS GPUS TPUS MEMORY CLUSTER WORKER GROUP AGE
namespace-1 pod-1 1 1 1 1Gi cluster-1 group-1 60m
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason for this result not having type column?

return cmd
}

// joinLabelMap joins a map of K8s label key-val entries into a label selector string
func joinLabelMap(labelMap map[string]string) string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved here from get_workergroup.go since it's used by get_nodes.go now too

memory resource.Quantity
namespace string
cluster string
_type string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

type is a reserved keyword in Go. Lmk if there's a better name or convention.

kubectl-plugin/pkg/cmd/get/get_nodes.go Outdated Show resolved Hide resolved
@davidxia
Copy link
Contributor Author

Updated to not use test fixture files. I inlined the expected output based on this suggestion.

with

```console
kubectl ray (get|list) node[s] (NODE_NAME) \
  [(-c/--ray-cluster) RAYCLUSTER] [(-n/--namespace) NAMESPACE] [(-A/--all-namespaces)]
```

## Example Usage

```console
$ kubectl ray get nodes -A

NAMESPACE          NAME                              CPUS   GPUS   TPUS   MEMORY  CLUSTER     TYPE     WORKER GROUP   AGE
explorer-guy       whyme-gpuworker-worker-mqgmn      36     4      0      256Gi   whyme       worker   gpuWorker      10d
explorer-guy       whyme-head-76l5c                  8      0      0      16Gi    whyme       head     headgroup      10d
foundation-botox   mrripvan-cpuworker-worker-lpkcs   16     0      0      64Gi    mrripvan    worker   cpuWorker      6h6m
foundation-botox   mrripvan-gpuworker-worker-snkgp   16     2      0      128Gi   mrripvan    worker   gpuWorker      6h6m
foundation-botox   mrripvan-head-swm6t               16     0      0      64Gi    mrripvan    head     headgroup      6h6m

$ kubectl ray get nodes -n foundation-botox

NAME                              CPUS   GPUS   TPUS   MEMORY  CLUSTER    TYPE     WORKER GROUP   AGE
mrripvan-cpuworker-worker-lpkcs   16     0      0      64Gi    mrripvan   worker   cpuWorker      6h6m
mrripvan-gpuworker-worker-snkgp   16     2      0      128Gi   mrripvan   worker   gpuWorker      6h6m
mrripvan-head-swm6t               16     0      0      64Gi    mrripvan   head     headgroup      6h6m

$ kubectl ray get nodes -n foundation-models -c oyster-v3
NAME                               CPUS   GPUS   TPUS   MEMORY   CLUSTER     TYPE     WORKER GROUP   AGE
oyster-v3-cpuworker-worker-kvhz5   20     0      0      200Gi    oyster-v3   worker   cpuWorker      17d
oyster-v3-gpuworker-worker-6s98f   200    8      0      1000Gi   oyster-v3   worker   gpuWorker      14d
oyster-v3-head-cflmj               25     0      0      200Gi    oyster-v3   head     headgroup      17d
oyster-v3-redis-worker-nh72b       1      0      0      12Gi     oyster-v3   worker   redis          17d

$ kubectl ray get nodes -n foundation-models -c oyster-v3 oyster-v3-gpuworker-worker-6s98f
NAME                               CPUS   GPUS   TPUS   MEMORY   CLUSTER     TYPE     WORKER GROUP   AGE
oyster-v3-gpuworker-worker-6s98f   200    8      0      1000Gi   oyster-v3   worker   gpuWorker      14d
```

Signed-off-by: David Xia <[email protected]>
@andrewsykim andrewsykim merged commit 9b32ab3 into ray-project:master Feb 13, 2025
20 checks passed
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.

3 participants