| 36 | |
| 37 | |
| 38 | def test_basic_dag_without_names_plot(): |
| 39 | @ray.remote |
| 40 | def a(*args, **kwargs): |
| 41 | pass |
| 42 | |
| 43 | tmp1 = a.bind() |
| 44 | tmp2 = a.bind() |
| 45 | tmp3 = a.bind(tmp1, tmp2) |
| 46 | tmp4 = a.bind() |
| 47 | tmp5 = a.bind(tmp4) |
| 48 | tmp6 = a.bind() |
| 49 | dag = a.bind(tmp3, tmp5, tmp6) |
| 50 | |
| 51 | with tempfile.TemporaryDirectory() as tmpdir: |
| 52 | to_file = os.path.join(tmpdir, "tmp.png") |
| 53 | ray.dag.plot(dag, to_file) |
| 54 | assert os.path.isfile(to_file) |
| 55 | |
| 56 | graph = ray.dag.vis_utils._dag_to_dot(dag) |
| 57 | to_string = graph.to_string() |
| 58 | assert "a -> a_2" in to_string |
| 59 | assert "a_1 -> a_2" in to_string |
| 60 | assert "a_3 -> a_4" in to_string |
| 61 | assert "a_2 -> a_6" in to_string |
| 62 | assert "a_4 -> a_6" in to_string |
| 63 | assert "a_5 -> a_6" in to_string |
| 64 | |
| 65 | |
| 66 | if __name__ == "__main__": |