mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 21:29:53 +08:00
[Java] Fix: task spec's resource map should contain CPU (#2987)
This commit is contained in:
committed by
Robert Nishihara
parent
68cf194e90
commit
4ffe1e3556
@@ -1,5 +1,6 @@
|
||||
package org.ray.runtime;
|
||||
|
||||
import java.util.HashMap;
|
||||
import org.ray.api.id.UniqueId;
|
||||
import org.ray.runtime.config.WorkerMode;
|
||||
import org.ray.runtime.task.TaskSpec;
|
||||
@@ -83,7 +84,7 @@ public class WorkerContext {
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
new HashMap<>(),
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,15 +18,16 @@ public class ResourceUtil {
|
||||
*/
|
||||
public static Map<String, Double> getResourcesMapFromArray(RayRemote remoteAnnotation) {
|
||||
Map<String, Double> resourceMap = new HashMap<>();
|
||||
if (remoteAnnotation == null) {
|
||||
return resourceMap;
|
||||
}
|
||||
for (ResourceItem item : remoteAnnotation.resources()) {
|
||||
if (!item.name().isEmpty()) {
|
||||
resourceMap.put(item.name(), item.value());
|
||||
if (remoteAnnotation != null) {
|
||||
for (ResourceItem item : remoteAnnotation.resources()) {
|
||||
if (!item.name().isEmpty()) {
|
||||
resourceMap.put(item.name(), item.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!resourceMap.containsKey(CPU_LITERAL)) {
|
||||
resourceMap.put(CPU_LITERAL, 0.0);
|
||||
}
|
||||
return resourceMap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user