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

Fix Creating cyclic connections raises exception incorrectly #23 #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion barfi/compute_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from .block_builder import Block
from typing import List, Dict

class CyclicConnectionError(RecursionError, NotImplementedError):
pass

class ComputeEngine(object):
def __init__(self, blocks: List[Block] = [], **kwargs) -> None:
Expand Down Expand Up @@ -90,7 +92,7 @@ def _map_block_link(self):
edge_id=_connection['id'])

if not nx.is_directed_acyclic_graph(self._graph):
raise('Cycle(s) detected. Not supported by `barfi` at the moment.')
raise CyclicConnectionError('Cycle(s) detected. Not supported by Barfi at the moment.')
else:
_compu_order = [self._map_block_id_name[node]
for node in nx.topological_sort(self._graph)]
Expand Down