mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[Java] support python worker command in raylet (#3092)
<!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> ## What do these changes do? support raylet, which is started by java runManager, to start python default_worker.py . So when doing local test of java call python task, it helps auto start python worker. ## Related issue number <!-- Are there any issues opened that will be resolved by merging this change? -->
This commit is contained in:
parent
9c1826ed69
commit
7c1fd19fd9
2 changed files with 26 additions and 1 deletions
|
@ -54,6 +54,7 @@ public class RayConfig {
|
|||
public final String plasmaStoreExecutablePath;
|
||||
public final String rayletExecutablePath;
|
||||
public final String driverResourcePath;
|
||||
public final String pythonWorkerCommand;
|
||||
|
||||
private void validate() {
|
||||
if (workerMode == WorkerMode.WORKER) {
|
||||
|
@ -136,6 +137,12 @@ public class RayConfig {
|
|||
jvmParameters = ImmutableList.of();
|
||||
}
|
||||
|
||||
if (config.hasPath("ray.worker.python-command")) {
|
||||
pythonWorkerCommand = config.getString("ray.worker.python-command");
|
||||
} else {
|
||||
pythonWorkerCommand = null;
|
||||
}
|
||||
|
||||
// redis configurations
|
||||
String redisAddress = config.getString("ray.redis.address");
|
||||
if (!redisAddress.isEmpty()) {
|
||||
|
|
|
@ -185,7 +185,7 @@ public class RunManager {
|
|||
"0", // number of initial workers
|
||||
String.valueOf(maximumStartupConcurrency),
|
||||
ResourceUtil.getResourcesStringFromMap(rayConfig.resources),
|
||||
"", // python worker command
|
||||
buildPythonWorkerCommand(), // python worker command
|
||||
buildWorkerCommandRaylet() // java worker command
|
||||
);
|
||||
|
||||
|
@ -247,4 +247,22 @@ public class RunManager {
|
|||
startProcess(command, null, "plasma_store");
|
||||
}
|
||||
|
||||
private String buildPythonWorkerCommand() {
|
||||
// disable python worker start from raylet, which starts from java
|
||||
if (rayConfig.pythonWorkerCommand == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
List<String> cmd = new ArrayList<>();
|
||||
cmd.add(rayConfig.pythonWorkerCommand);
|
||||
cmd.add("--node-ip-address=" + rayConfig.nodeIp);
|
||||
cmd.add("--object-store-name=" + rayConfig.objectStoreSocketName);
|
||||
cmd.add("--raylet-name=" + rayConfig.rayletSocketName);
|
||||
cmd.add("--redis-address=" + rayConfig.getRedisAddress());
|
||||
|
||||
String command = cmd.stream().collect(Collectors.joining(" "));
|
||||
LOGGER.debug("python worker command: {}", command);
|
||||
return command;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue