Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide nodes in dot that have no side effects for now #45

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/lib/block.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ let alias = function
| `Publish _ -> invalid_arg "Expected body or run"
| `Run b | `Build b -> b.alias

let hash = function
| `Publish _ -> None
| `Run b | `Build b -> b.hash
let hash = function `Publish _ -> None | `Run b | `Build b -> b.hash

let kind = function
| `Build _ -> `Build
Expand Down
12 changes: 11 additions & 1 deletion src/lib/dotrenderer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,23 @@ let render_ast_to_dot ppf hyperblocks : unit =
Format.fprintf ppf "\tstyle = %s\n" style;
Format.fprintf ppf "\tlabel = \"%s\"\n" name;

(* if commands have no obvious I/O remove them from the dot graph for now *)
let filtered_commands =
List.filter
(fun l ->
let ic = List.length (Leaf.inputs l)
and oc = List.length (Leaf.outputs l) in
ic + oc > 0)
commands
in

let renderer =
match kind with
| `Run -> render_command_to_dot
| `Publish -> render_publish_to_dot
| _ -> fun _a _b -> ()
in
List.iter (renderer ppf) commands;
List.iter (renderer ppf) filtered_commands;

Format.fprintf ppf "}\n")
hyperblocks;
Expand Down
Loading