-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Can you nest and reference other diagrams? #436
Comments
The closest thing I can think of would be something similar to using the no-op flag in neato ( See "-n[num]" in https://graphviz.gitlab.io/doc/info/command.html This library uses the Line 7 in c2b10f3
Line 111 in c2b10f3
Refering to the Graphviz library The
This library generates a graphviz ( Lines 150 to 151 in c2b10f3
I tried commenting out the line that removes the graphviz file in hopes that I could somehow use it with the no-op flag, but the graphviz file did not remain. |
@jacorbello Pretty sure the answer is "yes." That example is furthered below by adding separate external graphs contained in their own 1. create and save separate graphviz dot filesfrom diagrams import Diagram, Cluster
from diagrams.k8s.clusterconfig import HPA
from diagrams.k8s.compute import Deployment, Pod, ReplicaSet
from diagrams.k8s.network import Ingress, Service
with Diagram("Exposed Pod with 3 Replicas", show=False) as diag_1:
net = Ingress("domain.com") >> Service("svc")
net >> [Pod("pod1"),
Pod("pod2"),
Pod("pod3")] << ReplicaSet("rs") << Deployment("dp") << HPA("hpa")
diag_1.dot.save("diag_1.gv") from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB
with Diagram("Grouped Workers", show=False, direction="TB") as diag_2:
ELB("lb") >> [EC2("worker1"),
EC2("worker2"),
EC2("worker3"),
EC2("worker4"),
EC2("worker5")] >> RDS("events")
diag_2.dot.save("diag_2.gv") 2. load dot files and convert to
|
@clayms Do you know if it is possible to connect the two clusters in the final output? Something in the above example like |
@jobinjosem1 I think you would have to add some blank and zero size nodes to the final clusters. Then do something like what is shown here: #17 (comment) |
I'm new to
but instead modifying it a bit like:
That is, I would like to build up a diagram with the parent diagram having relationships between the subgraphs that I'm loading in as per @clayms' excellent example. And ideally without delving into the graphviz data structures and iterating through their internals looking for things created by other files that I don't want to open. The motivating use case is one or multiple people working on a large service oriented architecture where a parent document ties everyone's individual pieces of the overall architecture into a cohesive diagram at the top level. |
For arrows to clusters see #17 Otherwise, I approach the compartmentalisation of the diagrams differently - via python functions. Here are 3 files to show how I handle it. First - two independent diagrams aws.py
k8s.py
Then tie everything together combo.py
So here are three diagrams from these files I also make use of parameters to the functions. So I might pass in a thing to be linked to the component in the diagram. One overall diagram might pass in something high level, so the diagram overall can focus on what is in the called function sub-diagram within a high level overview around it, or another diagram might pass in some object more specific, where the sub-diagram needs to be seen connecting to the details of the wider diagram. Hope this make sense. |
Amazing, thanks @zingagent |
I'd like to create separate diagrams for various applications/departments/etc. Is there a way to create say 3 diagrams:
and reference them all in a "master" diagram?
This is in an effort to reference application dependencies between applications without having to update the same architecture in multiple diagrams.
The text was updated successfully, but these errors were encountered: