![](/img/trans.png)
[英]Ray.io: Could not serialize the argument <tensorflow.python.framework.ops.Graph object> for a task or actor __main__.run_inference
[英]Cross-Language Ray framework: io.ray.api.exception.RayActorException: The actor <id> died unexpectedly before finishing this task
我正在尝试从 Java 调用 python 远程 function,使用与此处提到的完全相同的代码: https://docs.ray.io/en/latest/ray-core/cross-language.html#java-calling-python
我收到此错误:
root@<user>-ubuntu:/dev/Ray_Java/target# java -jar Ray_Java-1.0-SNAPSHOT-jar-with-dependencies.jar
2023-01-23 11:00:10,206 INFO RunManager [main]: Ray runtime started @<ip> .
io.ray.api.exception.RayActorException: The actor <id> died unexpectedly before finishing this task.
at io.ray.runtime.object.ObjectSerializer.deserializeActorException(ObjectSerializer.java:257)
at io.ray.runtime.object.ObjectSerializer.deserialize(ObjectSerializer.java:104)
at io.ray.runtime.object.ObjectStore.get(ObjectStore.java:140)
at io.ray.runtime.AbstractRayRuntime.get(AbstractRayRuntime.java:144)
at io.ray.runtime.AbstractRayRuntime.get(AbstractRayRuntime.java:125)
at io.ray.runtime.AbstractRayRuntime.get(AbstractRayRuntime.java:120)
at io.ray.api.Ray.get(Ray.java:98)
at io.ray.runtime.object.ObjectRefImpl.get(ObjectRefImpl.java:77)
at demo.JavaCallPythonDemo.main(JavaCallPythonDemo.java:26)
JavaCallPythonDemo.java:26 是:Assert.assertEquals(objRef1.get(), 1);
版本/依赖项:
操作系统:Ubuntu 20.04 [LTS]、Python:3.8.10、Java:OpenJDK 11.0.17、Ray:2.2、Apache Maven:3.6.3
我覆盖了 ray.conf 文件并将运行模式指定为“CLUSTER”,并在单节点集群中运行它 我在独立的 maven 项目中使用它并在 pom 中指定了 ray-api 和 ray-runtime 依赖项.xml。 我已经包含了 maven-assembly 插件,并且正在使用“mvn install”创建这个项目的 jar,然后运行这个 jar(指定 JavaCallPythonDemo.java 作为主类)。
我能够从 Java 初始化 Ray,并成功运行 maven 生成的 jar。 这是相同的代码:
package demo;
import io.ray.api.Ray;
public class RayInit {
public static void main(String args[]) {
Ray.init();
System.out.println("is ray initialized: "+Ray.isInitialized());
Ray.shutdown();
}
}
io.ray.api.exception.RayActorException
表示目标 Python 演员已经死亡。
您可以找到目标 Python 演员的日志以查看死亡原因。 默认情况下,目标 Python actor 日志位于:
/tmp/ray/session_latest/logs/python-core-worker-xxxx
/tmp/ray/session_latest/logs/python-worker-xxxxx.out
/tmp/ray/session_latest/logs/python-worker-xxxxx.log
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.