mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 04:07:01 +08:00
[Java] Fix output parsing in RunManager (#12968)
* Fix output parsing in RunManager * change log level Co-authored-by: 灵洵 <fengbin.ffb@antgroup.com>
This commit is contained in:
@@ -75,14 +75,18 @@ public class RunManager {
|
||||
// address info of the local node.
|
||||
String script = String.format("import ray;"
|
||||
+ " print(ray._private.services.get_address_info_from_redis("
|
||||
+ "'%s', '%s', redis_password='%s', no_warning=True))",
|
||||
+ "'%s', '%s', redis_password='%s'))",
|
||||
rayConfig.getRedisAddress(), rayConfig.nodeIp, rayConfig.redisPassword);
|
||||
List<String> command = Arrays.asList("python", "-c", script);
|
||||
|
||||
String output = null;
|
||||
try {
|
||||
output = runCommand(command);
|
||||
JsonObject addressInfo = new JsonParser().parse(output).getAsJsonObject();
|
||||
// NOTE(kfstorm): We only parse the last line here in case there are some warning
|
||||
// messages appear at the beginning.
|
||||
String[] lines = output.split(System.lineSeparator());
|
||||
String lastLine = lines[lines.length - 1];
|
||||
JsonObject addressInfo = new JsonParser().parse(lastLine).getAsJsonObject();
|
||||
rayConfig.rayletSocketName = addressInfo.get("raylet_socket_name").getAsString();
|
||||
rayConfig.objectStoreSocketName = addressInfo.get("object_store_address").getAsString();
|
||||
rayConfig.nodeManagerPort = addressInfo.get("node_manager_port").getAsInt();
|
||||
|
||||
Reference in New Issue
Block a user