mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 01:37:40 +08:00
[java] Support resources management in raylet mode. (#2606)
This commit is contained in:
committed by
Robert Nishihara
parent
4a7be6f46d
commit
244337d381
@@ -124,6 +124,9 @@ public class RayParameters {
|
||||
@AConfig(comment = "worker fetch request size")
|
||||
public int worker_fetch_request_size = 10000;
|
||||
|
||||
@AConfig(comment = "static resource list of this node")
|
||||
public String static_resources = "";
|
||||
|
||||
public RayParameters(ConfigReader config) {
|
||||
if (null != config) {
|
||||
String networkInterface = config.getStringValue("ray.java", "network_interface", null,
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.ray.api.RayList;
|
||||
import org.ray.api.RayMap;
|
||||
import org.ray.api.RayObject;
|
||||
@@ -17,6 +18,7 @@ import org.ray.core.UniqueIdHelper;
|
||||
import org.ray.core.WorkerContext;
|
||||
import org.ray.spi.model.RayInvocation;
|
||||
import org.ray.spi.model.TaskSpec;
|
||||
import org.ray.util.ResourceUtil;
|
||||
import org.ray.util.logger.RayLog;
|
||||
|
||||
/**
|
||||
@@ -108,6 +110,8 @@ public class LocalSchedulerProxy {
|
||||
task.taskId = taskId;
|
||||
task.returnIds = returnIds;
|
||||
task.cursorId = invocation.getActor() != null ? invocation.getActor().getTaskCursor() : null;
|
||||
task.resources = ResourceUtil
|
||||
.getResourcesMapFromArray(invocation.getRemoteAnnotation().resources());
|
||||
|
||||
//WorkerContext.onSubmitTask();
|
||||
RayLog.core.info(
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.ray.spi.model;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import org.ray.api.UniqueID;
|
||||
import org.ray.util.ResourceUtil;
|
||||
|
||||
/**
|
||||
* Represents necessary information of a task for scheduling and executing.
|
||||
@@ -42,6 +44,9 @@ public class TaskSpec {
|
||||
// Id for create a target actor
|
||||
public UniqueID createActorId;
|
||||
|
||||
// The task's resource demands.
|
||||
public Map<String, Double> resources;
|
||||
|
||||
public UniqueID cursorId;
|
||||
|
||||
@Override
|
||||
@@ -56,6 +61,8 @@ public class TaskSpec {
|
||||
builder.append("\treturnIds: ").append(Arrays.toString(returnIds)).append("\n");
|
||||
builder.append("\tactorHandleId: ").append(actorHandleId).append("\n");
|
||||
builder.append("\tcreateActorId: ").append(createActorId).append("\n");
|
||||
builder.append("\tresources: ")
|
||||
.append(ResourceUtil.getResourcesFromatStringFromMap(resources)).append("\n");
|
||||
builder.append("\tcursorId: ").append(cursorId).append("\n");
|
||||
builder.append("\targs:\n");
|
||||
for (FunctionArg arg : args) {
|
||||
@@ -65,4 +72,5 @@ public class TaskSpec {
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user