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

Update --labels and add --labels-from-file options for Label Selector API #51706

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ryanaoleary
Copy link
Contributor

Why are these changes needed?

This PR updates the --labels option to ray start or ray init to accept a string list of key-value pairs mapping label names to label values. Labels follow Kubernetes label syntax. This PR also adds a --labels-from-file argument to support sourcing labels from a file. Files are expected to contain a valid JSON string containing a serialized key-value pair map. We use parse_node_labels_json to parse the argument passed to --labels-from-file.

Related issue number

#51564

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@ryanaoleary ryanaoleary marked this pull request as ready for review March 26, 2025 07:00
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
@jcotant1 jcotant1 added the core Issues that should be addressed in Ray Core label Mar 26, 2025
@MengjinYan MengjinYan self-assigned this Mar 26, 2025
@MengjinYan MengjinYan self-requested a review March 26, 2025 20:45
Copy link
Collaborator

@MengjinYan MengjinYan left a comment

Choose a reason for hiding this comment

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

Thanks!

default="{}",
type=str,
help="a JSON serialized dictionary mapping label name to label value.",
help="a JSON serialized dictionary mapping label name to label value sourced from a file.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the REP here: https://github.com/ray-project/enhancements/pull/60/files#diff-8ffbf04d141c252596eb1746813e1a8ea927b710fb74d252e11eba7c886c02a6R140, it mentioned that the content will be in YAML format. Wondering should we follow that or we want to update it to json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in b6e99ea, I changed it to read from file.

@ryanaoleary ryanaoleary requested a review from MengjinYan March 29, 2025 03:25
Copy link
Collaborator

@MengjinYan MengjinYan left a comment

Choose a reason for hiding this comment

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

Thanks!

Signed-off-by: Ryan O'Leary <[email protected]>
@MengjinYan MengjinYan added the go add ONLY when ready to merge, run all tests label Mar 31, 2025
@MengjinYan MengjinYan requested a review from edoakes March 31, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants