[java] Fix the logic of generating TaskID (#2747)

## What do these changes do?
Because the logic of generating `TaskID` in java is different from python's, there are many tests fail when we change the `Ray Core` code.
In this change,  I rewrote the logic of generating `TaskID` in java which is the same as the python's.

In java, we call the native method `_generateTaskId()` to generate a `TaskID` which is also used in python. We change `computePutId()`'s logic too.

## Related issue number
[#2608](https://github.com/ray-project/ray/issues/2608)
This commit is contained in:
Wang Qing
2018-08-28 04:11:33 +08:00
committed by Robert Nishihara
parent f37c260bdb
commit b4cba9a49f
17 changed files with 255 additions and 299 deletions
@@ -33,7 +33,7 @@ public class RayDevRuntime extends RayRuntime {
private byte[] createLocalActor(String className) {
UniqueID taskId = WorkerContext.currentTask().taskId;
UniqueID actorId = UniqueIdHelper.taskComputeReturnId(taskId, 0, false);
UniqueID actorId = UniqueIdHelper.computeReturnId(taskId, 0);
try {
Class<?> cls = Class.forName(className);
@@ -89,6 +89,11 @@ public class MockLocalScheduler implements LocalSchedulerLink {
}
@Override
public UniqueID generateTaskId(UniqueID driverId, UniqueID parentTaskId, int taskIndex) {
throw new RuntimeException("Not implemented here.");
}
@Override
public List<byte[]> wait(byte[][] objectIds, int timeoutMs, int numReturns) {
return store.wait(objectIds, timeoutMs, numReturns);