mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 13:47:22 +08:00
[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:
committed by
Robert Nishihara
parent
f37c260bdb
commit
b4cba9a49f
@@ -7,7 +7,7 @@ import java.util.Random;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
/**
|
||||
* Unique ID for task, worker, function...
|
||||
* Unique ID for task, worker, function.
|
||||
*/
|
||||
public class UniqueID implements Serializable {
|
||||
|
||||
@@ -42,7 +42,8 @@ public class UniqueID implements Serializable {
|
||||
|
||||
public UniqueID(byte[] id) {
|
||||
if (id.length != LENGTH) {
|
||||
throw new IllegalArgumentException("Illegal argument: " + id.toString());
|
||||
throw new IllegalArgumentException("Illegal argument for UniqueID, expect " + LENGTH
|
||||
+ " bytes, but got " + id.length + " bytes.");
|
||||
}
|
||||
|
||||
this.id = id;
|
||||
@@ -86,11 +87,6 @@ public class UniqueID implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isNil() {
|
||||
for (byte b : id) {
|
||||
if (b != (byte) 0xFF) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return this.equals(NIL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user