mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 21:23:10 +08:00
Updating zero capacity resource semantics (#4555)
This commit is contained in:
committed by
Robert Nishihara
parent
bb207a205b
commit
0f42f87ebc
@@ -7,13 +7,19 @@ import java.util.Map;
|
||||
* The options class for RayCall or ActorCreation.
|
||||
*/
|
||||
public abstract class BaseTaskOptions {
|
||||
public Map<String, Double> resources;
|
||||
public final Map<String, Double> resources;
|
||||
|
||||
public BaseTaskOptions() {
|
||||
resources = new HashMap<>();
|
||||
}
|
||||
|
||||
public BaseTaskOptions(Map<String, Double> resources) {
|
||||
for (Map.Entry<String, Double> entry : resources.entrySet()) {
|
||||
if (entry.getValue().compareTo(0.0) <= 0) {
|
||||
throw new IllegalArgumentException(String.format("Resource capacity should be " +
|
||||
"positive, but got resource %s = %f.", entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user