| 8 | |
| 9 | |
| 10 | def test_basic_dag_with_names_plot(): |
| 11 | @ray.remote |
| 12 | def a(*args, **kwargs): |
| 13 | pass |
| 14 | |
| 15 | tmp1 = a.options(name="tmp1").bind() |
| 16 | tmp2 = a.options(name="tmp2").bind() |
| 17 | tmp3 = a.options(name="tmp3").bind(tmp1, tmp2) |
| 18 | tmp4 = a.options(name="tmp4").bind() |
| 19 | tmp5 = a.options(name="tmp5").bind(tmp4) |
| 20 | tmp6 = a.options(name="tmp6").bind() |
| 21 | dag = a.bind(tmp3, tmp5, tmp6) |
| 22 | |
| 23 | with tempfile.TemporaryDirectory() as tmpdir: |
| 24 | to_file = os.path.join(tmpdir, "tmp.png") |
| 25 | ray.dag.plot(dag, to_file) |
| 26 | assert os.path.isfile(to_file) |
| 27 | |
| 28 | graph = ray.dag.vis_utils._dag_to_dot(dag) |
| 29 | to_string = graph.to_string() |
| 30 | assert "tmp1 -> tmp3" in to_string |
| 31 | assert "tmp2 -> tmp3" in to_string |
| 32 | assert "tmp4 -> tmp5" in to_string |
| 33 | assert "tmp3 -> a" in to_string |
| 34 | assert "tmp5 -> a" in to_string |
| 35 | assert "tmp6 -> a" in to_string |
| 36 | |
| 37 | |
| 38 | def test_basic_dag_without_names_plot(): |