mirror of
https://github.com/wassname/ray.git
synced 2026-07-03 10:36:19 +08:00
Limit number of concurrent workers started by hardware concurrency. (#2753)
* Limit number of concurrent workers started by hardware concurrency. * Check if std::thread::hardware_concurrency() returns 0. * Pass in max concurrency from Python. * Fix Java call to startRaylet. * Fix typo * Remove unnecessary cast. * Fix linting. * Cleanups on Java side. * Comment back in actor test. * Require maximum_startup_concurrency to be at least 1. * Fix linting and test. * Improve documentation. * Fix typo.
This commit is contained in:
committed by
Hao Chen
parent
3850e3ba64
commit
132f133214
@@ -623,10 +623,14 @@ public class RunManager {
|
||||
|
||||
String resourceArgument = ResourceUtil.getResourcesStringFromMap(staticResources);
|
||||
|
||||
int hardwareConcurrency = Runtime.getRuntime().availableProcessors();
|
||||
int maximumStartupConcurrency = Math.max(1, Math.min(staticResources.get("CPU").intValue(),
|
||||
hardwareConcurrency));
|
||||
|
||||
// The second-last arugment is the worker command for Python, not needed for Java.
|
||||
String[] cmds = new String[]{filePath, rayletSocketName, storeName, ip, gcsIp,
|
||||
gcsPort, "" + numWorkers, resourceArgument,
|
||||
"", workerCommand};
|
||||
gcsPort, String.valueOf(numWorkers), String.valueOf(maximumStartupConcurrency),
|
||||
resourceArgument, "", workerCommand};
|
||||
|
||||
Process p = startProcess(cmds, null, RunInfo.ProcessType.PT_RAYLET,
|
||||
"raylet", redisAddress, ip, redirect, cleanup);
|
||||
|
||||
Reference in New Issue
Block a user