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

Make PyPI package graphviz optional #70

Closed
leo-schick opened this issue May 10, 2022 · 2 comments
Closed

Make PyPI package graphviz optional #70

leo-schick opened this issue May 10, 2022 · 2 comments
Milestone

Comments

@leo-schick
Copy link
Member

Currently the PyPI package graphviz is required. I tested out running a mara instance on Google App Engine which worked fine except that you are not able to install additional linux packages (except you spin up a docker image which costs extra).

Would be interesting to investigate making graphviz optional by using the JS engine d3-graphviz when python package graphviz is not installed.

In addition, when running mara_pipelines headless there isn't a reason for graphviz and therefore IMHO this package should be defined as an extra requirement.

@jankatins
Copy link
Member

jankatins commented May 10, 2022

Any bad perf for big graphs (e.g. when chrome is getting memory starved or similar?)? If not, I would say go for it :-)

@leo-schick
Copy link
Member Author

I came now up with this soltion solution:

Mara Pipeline will by default use the graphviz shell tools. In case they are not found (exception graphviz.backend.ExecutableNotFound is thrown) we use a fallback to client-side rendering with d3-graphviz.
If that fails as well, you will still see the python exception thrown by graphviz.

For client-side rendering with d3-graphviz one has to add the following javascript libraries to the mara app:

@monkey_patch.wrap(mara_app.layout.js_files)
def js_files(original_function, response):
    files = original_function(response)
    files.append('https://d3js.org/d3.v7.min.js')
    files.append('https://unpkg.com/@hpcc-js/wasm@1.14.1/dist/index.min.js')
    files.append('https://unpkg.com/d3-graphviz@4.1.1/build/d3-graphviz.js')
    return files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants