MCPcopy Index your code
hub / github.com/ray-project/ray / test_log_java_worker_logs

Function test_log_java_worker_logs

python/ray/tests/test_logging_java.py:27–51  ·  view source on GitHub ↗
(shutdown_only, capsys)

Source from the content-addressed store, hash-verified

25 reason="Does not work on Windows and OSX.",
26)
27def test_log_java_worker_logs(shutdown_only, capsys):
28 with tempfile.TemporaryDirectory() as tmp_dir:
29 print("using tmp_dir", tmp_dir)
30 with open(os.path.join(tmp_dir, "MyClass.java"), "w") as f:
31 f.write(_MY_CLASS_JAVA)
32 subprocess.check_call(["javac", "MyClass.java"], cwd=tmp_dir)
33 subprocess.check_call(["jar", "-cf", "myJar.jar", "MyClass.class"], cwd=tmp_dir)
34
35 ray.init(
36 job_config=ray.job_config.JobConfig(code_search_path=[tmp_dir]),
37 )
38
39 handle = java_actor_class("MyClass").remote()
40 ray.get(handle.printToLog.remote("here's my random line!"))
41
42 def check():
43 out, err = capsys.readouterr()
44 out += err
45 with capsys.disabled():
46 print(out)
47 return "here's my random line!" in out
48
49 wait_for_condition(check)
50
51 ray.shutdown()
52
53
54if __name__ == "__main__":

Callers

nothing calls this directly

Calls 11

java_actor_classFunction · 0.90
wait_for_conditionFunction · 0.90
printFunction · 0.85
openFunction · 0.85
check_callMethod · 0.80
getMethod · 0.65
shutdownMethod · 0.65
joinMethod · 0.45
writeMethod · 0.45
initMethod · 0.45
remoteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…