Skip to content

Commit

Permalink
fix: generate mkdocs graphs with multiple dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ankeko committed Oct 11, 2023
1 parent 5d2d205 commit ed961db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions niceml/mkdocs/mdgraph.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Module for generating a graph in mkdocs"""
from dagster import JobDefinition
from dagster import JobDefinition, DependencyDefinition, MultiDependencyDefinition


def get_graph_md(job: JobDefinition) -> str:
Expand All @@ -8,7 +8,13 @@ def get_graph_md(job: JobDefinition) -> str:
graph_str = ""
for key, value in deps.items():
for _, val2 in value.items():
graph_str += f" {val2.node} --> {key.name};\n"
if isinstance(val2, DependencyDefinition):
graph_str += f" {val2.node} --> {key.name};\n"
elif isinstance(val2, MultiDependencyDefinition):
for dependency in val2.dependencies:
graph_str += f" {dependency.node} --> {key.name};\n"
else:
raise AttributeError("'val2' is not of expected type.")
if len(graph_str) == 0:
return ""

Expand Down
2 changes: 1 addition & 1 deletion niceml/mkdocs/mdjob.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Module for generating mkdocs str for jobs"""
from typing import List

from dagster.core.definitions import NodeDefinition
from dagster._core.definitions import NodeDefinition

from niceml.mkdocs.mdgraph import get_graph_md
from niceml.mkdocs.mdop import get_md_op
Expand Down

0 comments on commit ed961db

Please sign in to comment.