Open
Description
Search before asking
- I searched the issues and found no similar issues.
Ray Component
Ray Core
What happened + What you expected to happen
If the return type of Java class method is Object and an int value is returned, the result of ray task for this class's actor is Byte. We expect the result is Integer, so it can be casted to int. The same appearance happens for long and short.
If a float type value is returned, the result is Double. We are not sure whether this is the same problem.
Versions / Dependencies
all
Reproduction script
This is our test code:
import java.util.concurrent.atomic.AtomicInteger;
import io.ray.api.ActorHandle;
import io.ray.api.ObjectRef;
import io.ray.api.Ray;
import io.ray.api.options.ActorCreationOptions;
public class IntActorTest {
public static class Counter {
private AtomicInteger counter = new AtomicInteger(0);
public Object call(Object object) {
return counter.getAndIncrement();
}
}
public void main(String[] args) {
System.setProperty("ray.run-mode", "SINGLE_PROCESS");
System.setProperty("ray.jobmaster.gateway.serviceExportEnable", "false");
Ray.init();
try {
ActorHandle<Counter> actorHandle =
Ray.actor(Counter::new).setMaxRestarts(ActorCreationOptions.INFINITE_RESTART).remote();
for (int i = 0; i < 10; i++) {
ObjectRef<Integer> objectRef = actorHandle.task(Counter::call, "test").remote();
int result = (int) objectRef.get();
System.out.println(result);
}
} finally {
Ray.shutdown();
}
}
}
Anything else
No response
Are you willing to submit a PR?
- Yes I am willing to submit a PR!