Skip to content
Closed
Show file tree
Hide file tree
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: 2 additions & 2 deletions pytato/distributed/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ def add_needed_pid(pid: _DistributedPartId,
from pytato.partition import PartitionInducedCycleError
try:
compute_topological_order(pid_to_needed_pids)
except CycleError:
raise PartitionInducedCycleError
except CycleError as err:
raise PartitionInducedCycleError(err.node)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on inducer/pytools#159, this should probably be err.path.


logger.info("verify_distributed_partition completed successfully.")

Expand Down
9 changes: 5 additions & 4 deletions pytato/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
logger = logging.getLogger(__name__)

from pytools import memoize_method
from pytools.graph import CycleError
from pytato.transform import EdgeCachedMapper, CachedWalkMapper
from pytato.array import (
Array, AbstractResultWithNamedArrays, Placeholder,
Expand Down Expand Up @@ -209,13 +210,13 @@ def make_partition(self, outputs: DictOfNamedArrays) -> GraphPartition:
pid_to_output_names[pid_dependency].add(var_name)
pid_to_input_names[pid_target].add(var_name)

from pytools.graph import compute_topological_order, CycleError
from pytools.graph import compute_topological_order
try:
toposorted_part_ids = compute_topological_order(
pid_to_needing_pids,
lambda x: sorted(pid_to_output_names[x]))
except CycleError:
raise PartitionInducedCycleError
except CycleError as err:
raise PartitionInducedCycleError(err.node)

return GraphPartition(
parts={
Expand Down Expand Up @@ -311,7 +312,7 @@ class GraphPartition:
# }}}


class PartitionInducedCycleError(Exception):
class PartitionInducedCycleError(CycleError):
"""Raised by :func:`find_partition` if the partitioning induced a
cycle in the graph of partitions.
"""
Expand Down