mirror of
https://github.com/vale981/ray
synced 2025-03-05 10:01:43 -05:00
[Java] Use localhost instead of public ip (#21462)
Use localhost ip address instead of public ip for avoid security popups on MacOS.
This also reverts This reverts commit e4542be0d1
.
This commit is contained in:
parent
71fae21e8e
commit
57ff13461c
3 changed files with 13 additions and 3 deletions
|
@ -19,6 +19,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
||||
/** Configurations of Ray runtime. See `ray.default.conf` for the meaning of each field. */
|
||||
public class RayConfig {
|
||||
|
@ -111,8 +112,15 @@ public class RayConfig {
|
|||
if (config.hasPath("ray.node-ip")) {
|
||||
nodeIp = config.getString("ray.node-ip");
|
||||
} else {
|
||||
nodeIp = NetworkUtil.getIpAddress(null);
|
||||
if (SystemUtils.IS_OS_LINUX) {
|
||||
nodeIp = NetworkUtil.getIpAddress(null);
|
||||
} else {
|
||||
/// We use a localhost on MacOS or Windows to avid security popups.
|
||||
/// See the related issue https://github.com/ray-project/ray/issues/18730
|
||||
nodeIp = NetworkUtil.localhostIp();
|
||||
}
|
||||
}
|
||||
|
||||
// Job id.
|
||||
String jobId = config.getString("ray.job.id");
|
||||
if (!jobId.isEmpty()) {
|
||||
|
|
|
@ -28,8 +28,6 @@ public class RunManager {
|
|||
command.add("--head");
|
||||
command.add("--redis-password");
|
||||
command.add(rayConfig.redisPassword);
|
||||
command.add("--node-ip-address");
|
||||
command.add(rayConfig.nodeIp);
|
||||
command.addAll(rayConfig.headArgs);
|
||||
|
||||
String numGpus = System.getProperty("num-gpus");
|
||||
|
|
|
@ -43,4 +43,8 @@ public class NetworkUtil {
|
|||
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
public static String localhostIp() {
|
||||
return "127.0.0.1";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue