Skip to content
Open
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
1 change: 1 addition & 0 deletions pychunkedgraph/app/segmentation/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ def publish_edit(
"operation_id": int(result.operation_id),
"new_lvl2_ids": result.new_lvl2_ids.tolist(),
"new_root_ids": result.new_root_ids.tolist(),
"old_root_ids": result.old_root_ids.tolist(),
}

exchange = os.getenv("PYCHUNKEDGRAPH_EDITS_EXCHANGE", "pychunkedgraph")
Expand Down
16 changes: 14 additions & 2 deletions pychunkedgraph/graph/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class GraphEditOperation(ABC):
"parent_ts",
"privileged_mode",
]
Result = namedtuple("Result", ["operation_id", "new_root_ids", "new_lvl2_ids"])
Result = namedtuple(
"Result", ["operation_id", "new_root_ids", "new_lvl2_ids", "old_root_ids"]
)

def __init__(
self,
Expand Down Expand Up @@ -478,10 +480,19 @@ def execute(
new_root_ids,
new_lvl2_ids,
affected_records,
root_ids,
)
return result

def _write(self, lock, timestamp, new_root_ids, new_lvl2_ids, affected_records):
def _write(
self,
lock: locks.RootLock,
timestamp: datetime,
new_root_ids: np.ndarray,
new_lvl2_ids: np.ndarray,
affected_records: list,
old_root_ids: np.ndarray,
):
"""Helper to persist changes after an edit."""
new_root_ids = np.array(new_root_ids, dtype=basetypes.NODE_ID)
new_lvl2_ids = np.array(new_lvl2_ids, dtype=basetypes.NODE_ID)
Expand Down Expand Up @@ -522,6 +533,7 @@ def _write(self, lock, timestamp, new_root_ids, new_lvl2_ids, affected_records):
operation_id=lock.operation_id,
new_root_ids=new_root_ids,
new_lvl2_ids=new_lvl2_ids,
old_root_ids=old_root_ids,
)


Expand Down