Skip to content

Commit

Permalink
migration debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
akhileshh committed Sep 13, 2024
1 parent 0ed6b12 commit 77947f1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.0.3
current_version = 3.0.1
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion pychunkedgraph/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.0"
__version__ = "3.0.1"
22 changes: 18 additions & 4 deletions pychunkedgraph/graph/edits.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def remove_edges(
cg,
*,
atomic_edges: Iterable[np.ndarray],
operation_id: basetypes.OPERATION_ID = None,
operation_id: basetypes.OPERATION_ID = None, # type: ignore
time_stamp: datetime.datetime = None,
parent_ts: datetime.datetime = None,
):
Expand Down Expand Up @@ -522,7 +522,7 @@ def __init__(
cg,
*,
new_l2_ids: Iterable,
operation_id: basetypes.OPERATION_ID,
operation_id: basetypes.OPERATION_ID, # type: ignore
time_stamp: datetime.datetime,
new_old_id_d: Dict[np.uint64, Set[np.uint64]] = None,
old_new_id_d: Dict[np.uint64, Set[np.uint64]] = None,
Expand All @@ -542,7 +542,7 @@ def __init__(

def _update_id_lineage(
self,
parent: basetypes.NODE_ID,
parent: basetypes.NODE_ID, # type: ignore
children: np.ndarray,
layer: int,
parent_layer: int,
Expand Down Expand Up @@ -658,7 +658,21 @@ def _create_new_parents(self, layer: int):
self._update_id_lineage(parent, cc_ids, layer, parent_layer)
self.cg.cache.children_cache[parent] = cc_ids
cache_utils.update(self.cg.cache.parents_cache, cc_ids, parent)
sanity_check_single(self.cg, parent, self._operation_id)

try:
sanity_check_single(self.cg, parent, self._operation_id)
except AssertionError:
from pychunkedgraph.debug.utils import get_l2children

pairs = [
(a, b) for idx, a in enumerate(cc_ids) for b in cc_ids[idx + 1 :]
]
for c1, c2 in pairs:
l2c1 = get_l2children(self.cg, c1)
l2c2 = get_l2children(self.cg, c2)
if np.intersect1d(l2c1, l2c2).size:
msg = f"{self._operation_id}:{c1} {c2} have common children."
raise ValueError(msg)

def run(self) -> Iterable:
"""
Expand Down

0 comments on commit 77947f1

Please sign in to comment.