Java binding to ray fails during Ray.init() call

Hello,

I want to experiment with the java bindings for ray. I used ray version 1.2.0 (installed via pip) and the same for the java version (ray-api and ray-runtime both at 1.2.0, using Gradle). The code consists only of the “Ray.init()” call. However, I get the exception

Error: Invalid value for ‘–system-config’: {put_small_object_in_memory_store:false}

and the program crashes. My understanding from the documentation (Configuring Ray — Ray 3.0.0.dev0) is that no additional configuration is required for a single node cluster. Am I doing anything wrong?

Full output:

Exception in thread “main” java.lang.RuntimeException: Failed to initialize Ray runtime.
at io.ray.api.Ray.init(Ray.java:27)
at main.Main.main(Main.java:12)
2021-02-23 18:14:59,133 ERROR DefaultRayRuntimeFactory [main]: Failed to initialize ray runtime, with config {“ray”:{“address”:null,“head-args”:,“job”:{“code-search-path”:“”,“id”:“”,“jvm-options”:,“num-java-workers-per-process”:1,“worker-env”:{}},“logging”:{“dir”:“”,“level”:“INFO”,“max-backup-files”:10,“max-file-size”:“500MB”,“pattern”:“%d{yyyy-MM-dd HH:mm:ss,SSS} %p %c{1} [%t]: %m%n”},“object-store”:{“socket-name”:null},“raylet”:{“config”:{“put_small_object_in_memory_store”:false},“node-manager-port”:0,“socket-name”:null},“redis”:{“password”:“5241590000000000”},“run-mode”:“CLUSTER”,“session-dir”:null}}
Caused by: java.lang.RuntimeException: Failed to initialize ray runtime
java.lang.RuntimeException: Failed to start Ray runtime.
at io.ray.runtime.DefaultRayRuntimeFactory.createRayRuntime(DefaultRayRuntimeFactory.java:43)
at io.ray.api.Ray.init(Ray.java:38)
at io.ray.api.Ray.init(Ray.java:25)
at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:41)
… 1 more
Caused by: java.lang.RuntimeException: Failed to initialize ray runtime

at io.ray.runtime.RayNativeRuntime.start(RayNativeRuntime.java:75)
Caused by: java.lang.RuntimeException: Failed to start Ray runtime.
Caused by: java.lang.RuntimeException: Failed to start Ray runtime.

at io.ray.runtime.DefaultRayRuntimeFactory.createRayRuntime(DefaultRayRuntimeFactory.java:39)
at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:41)
at io.ray.api.Ray.init(Ray.java:38)
at io.ray.runtime.RayNativeRuntime.start(RayNativeRuntime.java:75)
at io.ray.api.Ray.init(Ray.java:25)
at main.Main.main(Main.java:12)
at io.ray.runtime.DefaultRayRuntimeFactory.createRayRuntime(DefaultRayRuntimeFactory.java:39)
… 3 more
Caused by: java.lang.RuntimeException: The exit value of the process is 2. Command: ray start --head --redis-password 5241590000000000 --system-config={“put_small_object_in_memory_store”:false}
Caused by: java.lang.RuntimeException: The exit value of the process is 2. Command: ray start --head --redis-password 5241590000000000 --system-config={“put_small_object_in_memory_store”:false}
output:
output:
Usage: ray start [OPTIONS]
Usage: ray start [OPTIONS]
Try ‘ray start --help’ for help.
Try ‘ray start --help’ for help.

Error: Invalid value for ‘–system-config’: {put_small_object_in_memory_store:false}

Caused by: java.lang.RuntimeException: The exit value of the process is 2. Command: ray start --head --redis-password 5241590000000000 --system-config={“put_small_object_in_memory_store”:false}

Error: Invalid value for ‘–system-config’: {put_small_object_in_memory_store:false}
at io.ray.runtime.runner.RunManager.runCommand(RunManager.java:117)

at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:39)
… 5 more
at io.ray.runtime.runner.RunManager.runCommand(RunManager.java:117)
at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:39)
… 5 more
Error: Invalid value for ‘–system-config’: {put_small_object_in_memory_store:false}

Task :Main.main() FAILED

Execution failed for task ‘:Main.main()’.

Just for completeness, this is my application:

package main;

import io.ray.api.Ray;

public class Main {
public static void main(String args) {
Ray.init();
}
}

@Alex could you take a look here?

This looks like a bug. Can we move this issue to github?

@simon-mo we didn’t end up touching this flag did we?

cc @raulchen

I have a similar test program with the same results. In my case, the error is
2021-03-03 14:32:47,496 INFO RunManager [main]: Ray runtime started @ 10.0.0.214.
2021-03-03 14:32:48,715 ERROR DefaultRayRuntimeFactory [main]: Failed to initialize ray runtime, with config {“ray”:{“address”:“10.0.0.214:6379”,“head-args”:[],“job”:{“code-search-path”:"",“id”:"",“jvm-options”:[],“num-java-workers-per-process”:1,“worker-env”:{}},“logging”:{“dir”:"",“level”:“INFO”,“max-backup-files”:10,“max-file-size”:“500MB”,“pattern”:"%d{yyyy-MM-dd HH:mm:ss,SSS} %p %c{1} [%t]: %m%n"},“object-store”:{“socket-name”:null},“raylet”:{“config”:{“put_small_object_in_memory_store”:false},“node-manager-port”:0,“socket-name”:null},“redis”:{“password”:“5241590000000000”},“run-mode”:“CLUSTER”,“session-dir”:"/tmp/ray/session_2021-03-03_14-32-45_731362_6982"}}

I tried something similar and I am getting a ClassNotFoundException!

Caused by: java.lang.ClassNotFoundException: io.ray.runtime.DefaultRayRuntimeFactory

@raghukiran did you add ray-runtime in your dependencies?

@folker.hoffmann I believe this issue is related to command line argument parsing. But I cannot reproduce this on my machine.
What is your OS and Java version?

yes, my pom has:

On Slack (Ray), someone mentioned that I need to provide the python install path for Ray. Maybe this is missing from the docs? Also, would be good to know how to do this in an IDE like intelliJ.

io.ray ray-api 1.2.0 io.ray ray-runtime 1.2.0

Are you still getting the ClassNotFoundException after adding ray-runtime? This error should have nothing to do with the Python path. If you still see this, can you try printing your classpath and see if the ray-runtime jar is actually there?