Skip to content

Commit

Permalink
Merge pull request #45 from quantifyearth/mwd-hide-no-side-effect-not…
Browse files Browse the repository at this point in the history
…es-in-dot

Hide nodes in dot that have no side effects for now
  • Loading branch information
mdales authored Apr 24, 2024
2 parents 8a73e4c + 44633e5 commit 62e86f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
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

0 comments on commit 62e86f5

Please sign in to comment.