Add gcs_service_enabled function to avoid getting environment variable directly (#7742)

This commit is contained in:
fangfengbin
2020-03-26 22:02:53 +08:00
committed by GitHub
parent ca6eabc9cb
commit e196fcdbaf
12 changed files with 31 additions and 21 deletions
@@ -72,6 +72,8 @@ public class RayConfig {
public final String jobResourcePath;
public final String pythonWorkerCommand;
public final boolean gcsServiceEnabled;
private static volatile RayConfig instance = null;
public static RayConfig getInstance() {
@@ -223,6 +225,9 @@ public class RayConfig {
numWorkersPerProcess = config.getInt("ray.raylet.config.num_workers_per_process_java");
gcsServiceEnabled = System.getenv("RAY_GCS_SERVICE_ENABLED") == null ||
System.getenv("RAY_GCS_SERVICE_ENABLED").toLowerCase().equals("true");
// Validate config.
validate();
LOGGER.debug("Created config: {}", this);
@@ -226,8 +226,7 @@ public class RunManager {
}
// start gcs server
if (System.getenv("RAY_GCS_SERVICE_ENABLED") == null ||
System.getenv("RAY_GCS_SERVICE_ENABLED") == "true") {
if (rayConfig.gcsServiceEnabled) {
String redisPasswordOption = "";
if (!Strings.isNullOrEmpty(rayConfig.headRedisPassword)) {
redisPasswordOption = rayConfig.headRedisPassword;