mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 17:02:43 +08:00
[Java] Generate head redis port randomly (#6879)
* Random head port * address comments.
This commit is contained in:
@@ -11,6 +11,8 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.ray.api.id.JobId;
|
||||
import org.ray.runtime.generated.Common.WorkerType;
|
||||
import org.ray.runtime.util.NetworkUtil;
|
||||
@@ -144,7 +146,12 @@ public class RayConfig {
|
||||
} else {
|
||||
this.redisAddress = null;
|
||||
}
|
||||
headRedisPort = config.getInt("ray.redis.head-port");
|
||||
|
||||
if (config.hasPath("ray.redis.head-port")) {
|
||||
headRedisPort = config.getInt("ray.redis.head-port");
|
||||
} else {
|
||||
headRedisPort = NetworkUtil.getUnusedPort();
|
||||
}
|
||||
numberRedisShards = config.getInt("ray.redis.shard-number");
|
||||
headRedisPassword = config.getString("ray.redis.head-password");
|
||||
redisPassword = config.getString("ray.redis.password");
|
||||
|
||||
@@ -58,7 +58,8 @@ ray {
|
||||
// Redis server, Raylet and object store.
|
||||
address: ""
|
||||
// If `redis.server` isn't provided, which port we should use to start redis server.
|
||||
head-port: 6379
|
||||
// If `head-port` is not provided, it will be generated randomly.
|
||||
// head-port: 6379
|
||||
// Below passwords should be consistent with the one defined in python/ray/ray_constants.py.
|
||||
// The password used to start the redis server on the head node.
|
||||
head-password: "5241590000000000"
|
||||
|
||||
Reference in New Issue
Block a user