mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 18:44:07 +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();
|
||||
|
||||
@@ -279,8 +279,7 @@ def get_address_info_from_redis_helper(redis_address,
|
||||
def get_address_info_from_redis(redis_address,
|
||||
node_ip_address,
|
||||
num_retries=5,
|
||||
redis_password=None,
|
||||
no_warning=False):
|
||||
redis_password=None):
|
||||
counter = 0
|
||||
while True:
|
||||
try:
|
||||
@@ -291,11 +290,10 @@ def get_address_info_from_redis(redis_address,
|
||||
raise
|
||||
# Some of the information may not be in Redis yet, so wait a little
|
||||
# bit.
|
||||
if not no_warning:
|
||||
logger.warning(
|
||||
"Some processes that the driver needs to connect to have "
|
||||
"not registered with Redis, so retrying. Have you run "
|
||||
"'ray start' on this node?")
|
||||
logger.warning(
|
||||
"Some processes that the driver needs to connect to have "
|
||||
"not registered with Redis, so retrying. Have you run "
|
||||
"'ray start' on this node?")
|
||||
time.sleep(1)
|
||||
counter += 1
|
||||
|
||||
|
||||
@@ -209,11 +209,15 @@ void ServiceBasedGcsClient::ReconnectGcsServer() {
|
||||
return;
|
||||
}
|
||||
|
||||
RAY_LOG(INFO) << "Attemptting to reconnect to GCS server: " << address.first << ":"
|
||||
<< address.second;
|
||||
RAY_LOG(DEBUG) << "Attemptting to reconnect to GCS server: " << address.first << ":"
|
||||
<< address.second;
|
||||
if (Ping(address.first, address.second, 100)) {
|
||||
RAY_LOG(INFO) << "Reconnected to GCS server: " << address.first << ":"
|
||||
<< address.second;
|
||||
// If `last_reconnect_address_` port is -1, it means that this is the first
|
||||
// connection and no log will be printed.
|
||||
if (last_reconnect_address_.second != -1) {
|
||||
RAY_LOG(INFO) << "Reconnected to GCS server: " << address.first << ":"
|
||||
<< address.second;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user