-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Core][Java Label Schedduling 1/n]Java worker add set & get node labels api #38011
[Core][Java Label Schedduling 1/n]Java worker add set & get node labels api #38011
Conversation
7b1eea0
to
d12ad33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good.
Map<String, String> labels = new HashMap<>(); | ||
labels.put("ray.io/node_id", nodeInfos.get(0).nodeId.toString()); | ||
Assert.assertEquals(nodeInfos.get(0).labels, labels); | ||
Ray.shutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use "try catch" in tests to improve the robustness, referencing to java/test/src/main/java/io/ray/test/RuntimeEnvTest.java.
d12ad33
to
de01388
Compare
Attention: External code changedA previous version of this PR changed code that is used or cited in external sources, e.g. blog posts. It looks like these changes have been reverted or are otherwise not present in this PR anymore. Please still carefully review the changes to make sure code we use in external sources still works. |
de01388
to
c0ca72d
Compare
…ls api Signed-off-by: LarryLian <[email protected]>
c0ca72d
to
5a33cbe
Compare
…ls api (ray-project#38011) ## Why are these changes needed? Java worker add set & get node labels API. 1. Set node labels for ray.init() ``` System.setProperty("ray.labels", "{\"gpu_type\":\"A100\",\"azone\":\"azone-1\"}"); Ray.init(); ``` 2. Get node labels ``` List<NodeInfo> nodeInfos = Ray.getRuntimeContext().getAllNodeInfo(); Assert.assertTrue(nodeInfos.size() == 1); Map<String, String> labels = new HashMap<>(); labels.put("ray.io/node_id", nodeInfos.get(0).nodeId.toString()); labels.put("gpu_type", "A100"); labels.put("azone", "azone-1"); Assert.assertEquals(nodeInfos.get(0).labels, labels); ``` ## Related issue number ray-project#34894 (P3)Implement the node affinity with labels interface in Java and transparently transmit it to the CoreWorker. Signed-off-by: NripeshN <[email protected]>
…ls api (ray-project#38011) ## Why are these changes needed? Java worker add set & get node labels API. 1. Set node labels for ray.init() ``` System.setProperty("ray.labels", "{\"gpu_type\":\"A100\",\"azone\":\"azone-1\"}"); Ray.init(); ``` 2. Get node labels ``` List<NodeInfo> nodeInfos = Ray.getRuntimeContext().getAllNodeInfo(); Assert.assertTrue(nodeInfos.size() == 1); Map<String, String> labels = new HashMap<>(); labels.put("ray.io/node_id", nodeInfos.get(0).nodeId.toString()); labels.put("gpu_type", "A100"); labels.put("azone", "azone-1"); Assert.assertEquals(nodeInfos.get(0).labels, labels); ``` ## Related issue number ray-project#34894 (P3)Implement the node affinity with labels interface in Java and transparently transmit it to the CoreWorker. Signed-off-by: harborn <[email protected]>
…ls api (ray-project#38011) ## Why are these changes needed? Java worker add set & get node labels API. 1. Set node labels for ray.init() ``` System.setProperty("ray.labels", "{\"gpu_type\":\"A100\",\"azone\":\"azone-1\"}"); Ray.init(); ``` 2. Get node labels ``` List<NodeInfo> nodeInfos = Ray.getRuntimeContext().getAllNodeInfo(); Assert.assertTrue(nodeInfos.size() == 1); Map<String, String> labels = new HashMap<>(); labels.put("ray.io/node_id", nodeInfos.get(0).nodeId.toString()); labels.put("gpu_type", "A100"); labels.put("azone", "azone-1"); Assert.assertEquals(nodeInfos.get(0).labels, labels); ``` ## Related issue number ray-project#34894 (P3)Implement the node affinity with labels interface in Java and transparently transmit it to the CoreWorker.
…ls api (ray-project#38011) ## Why are these changes needed? Java worker add set & get node labels API. 1. Set node labels for ray.init() ``` System.setProperty("ray.labels", "{\"gpu_type\":\"A100\",\"azone\":\"azone-1\"}"); Ray.init(); ``` 2. Get node labels ``` List<NodeInfo> nodeInfos = Ray.getRuntimeContext().getAllNodeInfo(); Assert.assertTrue(nodeInfos.size() == 1); Map<String, String> labels = new HashMap<>(); labels.put("ray.io/node_id", nodeInfos.get(0).nodeId.toString()); labels.put("gpu_type", "A100"); labels.put("azone", "azone-1"); Assert.assertEquals(nodeInfos.get(0).labels, labels); ``` ## Related issue number ray-project#34894 (P3)Implement the node affinity with labels interface in Java and transparently transmit it to the CoreWorker. Signed-off-by: e428265 <[email protected]>
…ls api (ray-project#38011) ## Why are these changes needed? Java worker add set & get node labels API. 1. Set node labels for ray.init() ``` System.setProperty("ray.labels", "{\"gpu_type\":\"A100\",\"azone\":\"azone-1\"}"); Ray.init(); ``` 2. Get node labels ``` List<NodeInfo> nodeInfos = Ray.getRuntimeContext().getAllNodeInfo(); Assert.assertTrue(nodeInfos.size() == 1); Map<String, String> labels = new HashMap<>(); labels.put("ray.io/node_id", nodeInfos.get(0).nodeId.toString()); labels.put("gpu_type", "A100"); labels.put("azone", "azone-1"); Assert.assertEquals(nodeInfos.get(0).labels, labels); ``` ## Related issue number ray-project#34894 (P3)Implement the node affinity with labels interface in Java and transparently transmit it to the CoreWorker. Signed-off-by: Victor <[email protected]>
Why are these changes needed?
Java worker add set & get node labels API.
Related issue number
#34894
(P3)Implement the node affinity with labels interface in Java and transparently transmit it to the CoreWorker.
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.