diff --git a/.github/workflows/pydantic-2.yml b/.github/workflows/pydantic-2.yml index 948a482..b6aca37 100644 --- a/.github/workflows/pydantic-2.yml +++ b/.github/workflows/pydantic-2.yml @@ -27,4 +27,4 @@ jobs: - name: Run tests shell: bash -el {0} run: | - cd tests/pydantic-2 && poetry run pytest -Werror + cd tests/pydantic-2 && poetry run pytest diff --git a/.github/workflows/python-3-9.yml b/.github/workflows/python-3-9.yml index 33dd6d3..784aec7 100644 --- a/.github/workflows/python-3-9.yml +++ b/.github/workflows/python-3-9.yml @@ -27,4 +27,4 @@ jobs: - name: Run tests shell: bash -el {0} run: | - cd tests/python-3-9 && poetry run pytest -Werror + cd tests/python-3-9 && poetry run pytest diff --git a/substrate/core/coregraph.py b/substrate/core/coregraph.py index dcbb70b..7eeb652 100644 --- a/substrate/core/coregraph.py +++ b/substrate/core/coregraph.py @@ -22,6 +22,10 @@ def __init__(self, id=None, initial_args=None): def futures(self) -> List[BaseFuture]: raise NotImplementedError + def add_edge(self, u_node: CoreNode, v_node: CoreNode, **kwargs) -> "CoreGraph": + self.DAG.add_edge(u_node, v_node, **kwargs) + return self + def add_node(self, node: CoreNode) -> "CoreGraph": if self.DAG.has_node(node): raise ValueError(f"Node with id {node.id} already exists") diff --git a/substrate/substrate.py b/substrate/substrate.py index 8ae0c6f..f0f1fb8 100644 --- a/substrate/substrate.py +++ b/substrate/substrate.py @@ -96,7 +96,8 @@ def collect_nodes(node): graph = Graph() for node in all_nodes: - graph.add_node(node) + if not graph.DAG.has_node(node): + graph.add_node(node) for depend_node in node._depends: graph.add_edge(depend_node, node) graph_serialized = graph.to_dict()