[xray] Track ray.get calls as task dependencies (#2362)

This commit is contained in:
Stephanie Wang
2018-07-27 11:59:17 -07:00
committed by Robert Nishihara
parent 5b015f9a79
commit 6675361684
20 changed files with 472 additions and 198 deletions
@@ -2,6 +2,7 @@ package org.ray.core;
import org.ray.api.UniqueID;
import org.ray.core.model.RayParameters;
import org.ray.core.model.WorkerMode;
import org.ray.spi.model.TaskSpec;
public class WorkerContext {
@@ -35,7 +36,11 @@ public class WorkerContext {
TaskSpec dummy = new TaskSpec();
dummy.parentTaskId = UniqueID.nil;
dummy.taskId = UniqueID.nil;
if (params.worker_mode == WorkerMode.DRIVER) {
dummy.taskId = UniqueID.randomId();
} else {
dummy.taskId = UniqueID.nil;
}
dummy.actorId = UniqueID.nil;
dummy.driverId = params.driver_id;
prepare(dummy, null);
@@ -109,6 +109,7 @@ public class RayNativeRuntime extends RayRuntime {
WorkerContext.currentWorkerId(),
UniqueID.nil,
isWorker,
WorkerContext.currentTask().taskId,
0
);
@@ -237,4 +238,4 @@ public class RayNativeRuntime extends RayRuntime {
throw new TaskExecutionException(log, e);
}
}
}
}
@@ -26,13 +26,13 @@ public class DefaultLocalSchedulerClient implements LocalSchedulerLink {
private long client = 0;
public DefaultLocalSchedulerClient(String schedulerSockName, UniqueID clientId, UniqueID actorId,
boolean isWorker, long numGpus) {
boolean isWorker, UniqueID driverId, long numGpus) {
client = _init(schedulerSockName, clientId.getBytes(), actorId.getBytes(), isWorker,
numGpus);
driverId.getBytes(), numGpus);
}
private static native long _init(String localSchedulerSocket, byte[] workerId, byte[] actorId,
boolean isWorker, long numGpus);
boolean isWorker, byte[] driverTaskId, long numGpus);
private static native byte[] _computePutId(long client, byte[] taskId, int putIndex);