mirror of
https://github.com/wassname/ray.git
synced 2026-07-15 11:25:40 +08:00
[java] Improve UniqueID code. (#2723)
This commit is contained in:
committed by
Robert Nishihara
parent
4f4bea086a
commit
26d3c0655c
@@ -209,7 +209,7 @@ public abstract class RayRuntime implements RayApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* get the task identity of the currently running task, UniqueID.Nil if not inside any
|
||||
* get the task identity of the currently running task, UniqueID.NIL if not inside any
|
||||
*/
|
||||
public UniqueID getCurrentTaskId() {
|
||||
return worker.getCurrentTaskId();
|
||||
@@ -381,7 +381,7 @@ public abstract class RayRuntime implements RayApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* get the object put identity of the currently running task, UniqueID.Nil if not inside any
|
||||
* get the object put identity of the currently running task, UniqueID.NIL if not inside any
|
||||
*/
|
||||
public UniqueID[] getCurrentTaskReturnIDs() {
|
||||
return worker.getCurrentTaskReturnIDs();
|
||||
|
||||
@@ -67,9 +67,8 @@ public class Worker {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private RayObject taskSubmit(UniqueID taskId, MethodId methodId, Object[] args) {
|
||||
RayInvocation ri = createRemoteInvocation(methodId, args, RayActor.nil);
|
||||
RayInvocation ri = createRemoteInvocation(methodId, args, RayActor.NIL);
|
||||
return scheduler.submit(taskId, ri);
|
||||
}
|
||||
|
||||
@@ -95,7 +94,7 @@ public class Worker {
|
||||
RayFunc func, Object[] args) {
|
||||
Preconditions.checkNotNull(taskId);
|
||||
MethodId mid = methodIdOf(func);
|
||||
RayInvocation ri = createRemoteInvocation(mid, args, RayActor.nil);
|
||||
RayInvocation ri = createRemoteInvocation(mid, args, RayActor.NIL);
|
||||
return scheduler.submitActorCreationTask(taskId, createActorId, ri);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ public class WorkerContext {
|
||||
currentWorkerCtx.set(ctx);
|
||||
|
||||
TaskSpec dummy = new TaskSpec();
|
||||
dummy.parentTaskId = UniqueID.nil;
|
||||
dummy.parentTaskId = UniqueID.NIL;
|
||||
if (params.worker_mode == WorkerMode.DRIVER) {
|
||||
dummy.taskId = UniqueID.randomId();
|
||||
} else {
|
||||
dummy.taskId = UniqueID.nil;
|
||||
dummy.taskId = UniqueID.NIL;
|
||||
}
|
||||
dummy.actorId = UniqueID.nil;
|
||||
dummy.actorId = UniqueID.NIL;
|
||||
dummy.driverId = params.driver_id;
|
||||
prepare(dummy, null);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RayParameters {
|
||||
public int local_scheduler_rpc_port = 34567;
|
||||
|
||||
@AConfig(comment = "driver ID when the worker is served as a driver")
|
||||
public UniqueID driver_id = UniqueID.nil;
|
||||
public UniqueID driver_id = UniqueID.NIL;
|
||||
|
||||
@AConfig(comment = "logging directory")
|
||||
public String log_dir = "/tmp/raylogs";
|
||||
|
||||
@@ -28,14 +28,14 @@ public class LocalSchedulerProxy {
|
||||
|
||||
public RayObject submit(UniqueID taskId, RayInvocation invocation) {
|
||||
UniqueID[] returnIds = genReturnIds(taskId, 1);
|
||||
this.doSubmit(invocation, taskId, returnIds, UniqueID.nil);
|
||||
this.doSubmit(invocation, taskId, returnIds, UniqueID.NIL);
|
||||
return new RayObject(returnIds[0]);
|
||||
}
|
||||
|
||||
public RayObject submitActorTask(UniqueID taskId, RayInvocation invocation) {
|
||||
// add one for the dummy return ID
|
||||
UniqueID[] returnIds = genReturnIds(taskId, 2);
|
||||
this.doSubmit(invocation, taskId, returnIds, UniqueID.nil);
|
||||
this.doSubmit(invocation, taskId, returnIds, UniqueID.NIL);
|
||||
return new RayObject(returnIds[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.ray.api.UniqueID;
|
||||
*/
|
||||
public class RayInvocation {
|
||||
|
||||
private static final RayActor<?> nil = new RayActor<>(UniqueID.nil, UniqueID.nil);
|
||||
private static final RayActor<?> nil = new RayActor<>(UniqueID.NIL, UniqueID.NIL);
|
||||
public final String className;
|
||||
/**
|
||||
* unique id for a method.
|
||||
|
||||
Reference in New Issue
Block a user