mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
37.37k stars 2.44k forks source link

Why the node of result png is blank? #229

Open lipingliang opened 4 years ago

lipingliang commented 4 years ago

dear friends: in my program, the node of result png is blank, why? help me, thanks! event_processing

the code:

from diagrams import Cluster, Diagram from diagrams.aws.compute import ECS, EKS, Lambda from diagrams.aws.database import Redshift from diagrams.aws.integration import SQS from diagrams.aws.storage import S3

with Diagram("Event Processing", show=True): source = EKS("k8s source")

with Cluster("Event Flows"):
    with Cluster("Event Workers"):
        workers = [ECS("worker1"),
                   ECS("worker2"),
                   ECS("worker3")]

    queue = SQS("event queue")

    with Cluster("Processing"):
        handlers = [Lambda("proc1"),
                    Lambda("proc2"),
                    Lambda("proc3")]

store = S3("events store")
dw = Redshift("analytics")

source >> workers >> queue >> handlers
handlers >> store
handlers >> dw
gabriel-tessier commented 4 years ago

@lipingliang Do you have error in the console? Which version do you use?

I tried with last version 0.15 your code and it generate this: event_processing

Maybe try the example code and see if the icon display...

https://diagrams.mingrammer.com/docs/getting-started/examples

If icons don't display try to reinstall.

lipingliang commented 4 years ago

thanks! I have reinstall 3 times, the problem remains.

lipingliang commented 4 years ago

My diagrams version is 0.16.0. In console, the error: can't open clustered_web_services.

leandrodamascena commented 4 years ago

@mingrammer I have some experience with bug reporting in an open source project and I believe I can create a decorator to detect errors in the project and facilitate the reporting of bugs and problems like this. I think in this case it could be useful.

What do you think of the idea? I can do a PR.

gabriel-tessier commented 4 years ago

@lipingliang Can you prevent copy paste the previous message and only post your reply it will make more easy to follow. Thanks!

Can you put in gist again your code well formatted. (In your first post, there's indentations problems). I expect that you may have some indentations errors that may raise the error you provided. Let's go step by step and try to figure out what is wrong with your installation.

Can you provide more information about your environment (OS: Windows Mac Linux .... Python version etc...) How did you install Diagrams? which version of graphiz do you have? This may help us to reproduce the problem.

lipingliang commented 4 years ago

@gabriel-tessier thank you very much! My OS is Win7, Python version is 3.6. I use pycharm installing diagrams. The graphviz version is 0.13.2. Now, I run below code, the error is: 'Global diagrams context not set up'. from diagrams import Cluster, Diagram from diagrams.aws.compute import ECS, EKS, Lambda from diagrams.aws.database import Redshift from diagrams.aws.integration import SQS from diagrams.aws.storage import S3

with Diagram("Event Processing", show=True): source = EKS("k8s source")

with Cluster("Event Flows"): with Cluster("Event Workers"): workers = [ECS("worker1"), ECS("worker2"), ECS("worker3")]

queue = SQS("event queue")

with Cluster("Processing"):
    handlers = [Lambda("proc1"),
                Lambda("proc2"),
                Lambda("proc3")]

store = S3("events store") dw = Redshift("analytics")

source >> workers >> queue >> handlers handlers >> store handlers >> dw

the result is: 图片

the debug info is : 图片

the version is : 图片 图片

mingrammer commented 4 years ago

@leandrodamascena Could you please give me some more details? Pseudo code would be greatly helpful!

gabriel-tessier commented 4 years ago

@lipingliang

I'm sorry I can't reproduce your problem but it look like it's a problem with your system installation... and I don't have windows 7 to test. Your initial problem with the pictures that don't display can be maybe related to this issue, if the resources folder can't be find: https://github.com/mingrammer/diagrams/issues/163

Maybe somebody else with Windows and similar environment can reproduce the error and solve your problem.

gabriel-tessier commented 4 years ago

@lipingliang

Actually you can build your diagrams using docker, for the installation follow the instruction here: https://github.com/mingrammer/diagrams/blob/master/DEVELOPMENT.md

Then you can put you file with the python code in the root of the source directory and run docker exec diagrams-1.0 python your_file.py and it will generate your diagrams file.

Hope it help.

seqizz commented 3 years ago

Hi there :wave:

I have a similar issue, OS is Linux/NixOS, installed version 0.19.1.

Following code:

#!/usr/bin/env python3
from diagrams import Diagram
from diagrams.generic.os import LinuxGeneral
from diagrams.generic.os import Centos

with Diagram("Grouped Workers", show=False, direction="TB"):
    Centos("lb") >> [LinuxGeneral("worker1"), LinuxGeneral("w2")] >> LinuxGeneral("test")

Generates this:

grouped_workers

I suspect this is related with something missing, but I can't see any warnings/errors anywhere. Dependencies supplied are:

Can I help debugging further?

gabriel-tessier commented 3 years ago

Hi @seqizz,

Is graphviz installed on your system? https://www.graphviz.org/download/#linux If it's installed can you provide the version? Thanks

Can you consider using docker as described here: https://github.com/mingrammer/diagrams/blob/master/DEVELOPMENT.md

Hope it help you debugging your problem.

seqizz commented 3 years ago

Hi,

Yes, graphviz version 2.42.2 is installed.

I was trying to solve this without Docker, since I was planning to package it for NixOS also. But apparently it's already packaged. Trying from that derivation, no issues anymore. :tada:

Sorry for the noise & thanks!

agorgl commented 3 years ago

Having the same issue, by using an Arch Linux package from the AUR: web_service

No errors in the stdout/stderr, nothing at all.

agorgl commented 3 years ago

Package was missing resources. Sent instructions to the maintainer to fix this!

lostinplace commented 2 years ago

what were the instructions to make this work?

tommycarstensen commented 1 year ago

Was a solution to this ever provided? I also get this error message:

raise EnvironmentError("Global diagrams context not set up")      

OSError: Global diagrams context not set up

yuri-scaranni commented 1 week ago

I was having the same error here, running the code in pycharm. I just change to run in command line 'python mycode.py'

And the image was generated in the correct way. I believe something is missing in my venv in pycharm, but command line works fine.