Skip to content

Commit

Permalink
#38: generate a WfInstance from a .dot file
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfsilva committed Mar 19, 2024
1 parent 2534da2 commit 164f835
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ Then you can install pygraphviz by running:
python3 -m pip install pygraphviz
```

#### pydot
WfCommons uses _pydot_ for reading and writing DOT files. If you want to enable
this feature, you will have to install the pydot package:
```
python3 -m pip install pydot
```

## Get in Touch

The main channel to reach the WfCommons team is via the support email:
Expand Down
7 changes: 7 additions & 0 deletions wfcommons/common/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# (at your option) any later version.

import getpass
import importlib
import json
import networkx as nx
import pathlib
Expand Down Expand Up @@ -181,6 +182,12 @@ def read_dot(self, dot_file_path: Optional[pathlib.Path] = None) -> None:
"""
if not dot_file_path:
raise FileNotFoundError(f"Not able to find the dot file: {dot_file_path}.")

graphviz_found = importlib.util.find_spec('pydot')
if graphviz_found is None:
raise ModuleNotFoundError(
f"\'pydot\' package not found: call to {type(self).__name__}.read_dot() failed.")

graph = nx.drawing.nx_pydot.read_dot(dot_file_path)

tasks_map = {}
Expand Down

0 comments on commit 164f835

Please sign in to comment.