(shutdown_only, capsys)
| 25 | reason="Does not work on Windows and OSX.", |
| 26 | ) |
| 27 | def 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 | |
| 54 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected
searching dependent graphs…