Skip to content

Conversation

larrylian
Copy link
Contributor

@larrylian larrylian commented Jun 2, 2023

Why are these changes needed?

Add labels param in python ray.init() to setting node labels
user cases:

  labels = {"gpu_type": "A100", "region": "us"}
  ray.init(labels=labels)
  assert ray.nodes()[0]["Labels"] == labels
  ray.shutdown()
  ray.init(labels={})
  assert ray.nodes()[0]["Labels"] == {}

Related issue number

Enhancing node affinity scheduling feature through node labels #34894

(P1)Finalize the format for setting node labels in the ray.init() interface of Python worker.

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 :(

@@ -1203,6 +1203,7 @@ def init(
namespace: Optional[str] = None,
runtime_env: Optional[Union[Dict[str, Any], "RuntimeEnv"]] = None, # noqa: F821
storage: Optional[str] = None,
labels: Optional[Dict[str, str]] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these are kwargs and the ordering doesn't matter, let's put this next to resources, that will logically be the best place to put it :)

Copy link
Contributor

@pcmoritz pcmoritz left a comment

Choose a reason for hiding this comment

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

Please address the comment before merging it :)

node labels

Signed-off-by: LarryLian <554538252@qq.com>
@larrylian
Copy link
Contributor Author

Please address the comment before merging it :)

I went on vacation last week, and I have fixed now, and I am waiting for the CI to be merge.

@jjyao jjyao merged commit 0e50436 into ray-project:master Jun 12, 2023
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
…ing node labels (ray-project#36007)

Signed-off-by: LarryLian <554538252@qq.com>
Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
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.

4 participants