From 3397942f3cba03d9f04e9cd0ad7bca45a926c7a7 Mon Sep 17 00:00:00 2001 From: Ketan Umare <16888709+kumare3@users.noreply.github.com> Date: Fri, 9 Jul 2021 15:09:41 -0700 Subject: [PATCH] Graphviz does not like hyphens #patch (#141) * Cluster names cannot have `-` in them. Signed-off-by: Ketan Umare * clusters with labels Signed-off-by: Ketan Umare --- flytectl/go.sum | 2 -- flytectl/pkg/visualize/graphviz.go | 10 ++++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flytectl/go.sum b/flytectl/go.sum index b5433777b6..802b4060f5 100644 --- a/flytectl/go.sum +++ b/flytectl/go.sum @@ -339,8 +339,6 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/flyteorg/flyteidl v0.19.8 h1:jWWIEnFMgJCZm/XK25Xts4+kQhoOrd5dWgLj/fLsbIg= -github.com/flyteorg/flyteidl v0.19.8/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U= github.com/flyteorg/flyteidl v0.19.9 h1:1j4/YbV/G1m2hrK017F9K0JYZYxCCwf4qtEkiNnUiEw= github.com/flyteorg/flyteidl v0.19.9/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U= github.com/flyteorg/flytestdlib v0.3.13/go.mod h1:Tz8JCECAbX6VWGwFT6cmEQ+RJpZ/6L9pswu3fzWs220= diff --git a/flytectl/pkg/visualize/graphviz.go b/flytectl/pkg/visualize/graphviz.go index 314c325148..08aa188716 100644 --- a/flytectl/pkg/visualize/graphviz.go +++ b/flytectl/pkg/visualize/graphviz.go @@ -229,8 +229,9 @@ func (gb *graphBuilder) constructNode(parentGraphName string, prefix string, gra } gb.nodeClusters[name] = parentGraphName case *core.Node_BranchNode: - branchSubGraphName := SubgraphPrefix + n.Metadata.Name - err := graph.AddSubGraph(parentGraphName, branchSubGraphName, nil) + sanitizedName := strings.ReplaceAll(n.Metadata.Name, "-", "_") + branchSubGraphName := SubgraphPrefix + sanitizedName + err := graph.AddSubGraph(parentGraphName, branchSubGraphName, map[string]string{LabelAttr: sanitizedName}) if err != nil { return nil, err } @@ -247,8 +248,9 @@ func (gb *graphBuilder) constructNode(parentGraphName string, prefix string, gra return nil, err } } else { - subGraphName := SubgraphPrefix + name - err := graph.AddSubGraph(parentGraphName, subGraphName, nil) + sanitizedName := strings.ReplaceAll(name, "-", "_") + subGraphName := SubgraphPrefix + sanitizedName + err := graph.AddSubGraph(parentGraphName, subGraphName, map[string]string{LabelAttr: sanitizedName}) if err != nil { return nil, err }