Skip to content

Commit fbea005

Browse files
committed
fix(upgrade): include cx edges at node_ts explicitly
1 parent e23d767 commit fbea005

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pychunkedgraph/ingest/upgrade/parent_layer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _get_cx_edges_at_timestamp(node, response, ts):
5151

5252

5353
def _populate_cx_edges_with_timestamps(
54-
cg: ChunkedGraph, layer: int, nodes: list, earliest_ts
54+
cg: ChunkedGraph, layer: int, nodes: list, nodes_ts:list, earliest_ts
5555
):
5656
"""
5757
Collect timestamps of edits from children, since we use the same timestamp
@@ -63,9 +63,10 @@ def _populate_cx_edges_with_timestamps(
6363
all_children = np.concatenate(list(CHILDREN.values()))
6464
response = cg.client.read_nodes(node_ids=all_children, properties=attrs)
6565
timestamps_d = get_parent_timestamps(cg, nodes)
66-
for node in nodes:
66+
for node, node_ts in zip(nodes, nodes_ts):
6767
CX_EDGES[node] = {}
6868
timestamps = timestamps_d[node]
69+
timestamps.add(node_ts)
6970
for ts in sorted(timestamps):
7071
if ts < earliest_ts:
7172
ts = earliest_ts
@@ -82,6 +83,7 @@ def update_cross_edges(cg: ChunkedGraph, layer, node, node_ts, earliest_ts) -> l
8283
try:
8384
cx_edges_d = CX_EDGES[node][node_ts]
8485
except KeyError:
86+
print(CX_EDGES)
8587
raise KeyError(f"{node}:{node_ts}")
8688
edges = np.concatenate([empty_2d] + list(cx_edges_d.values()))
8789
if edges.size:
@@ -149,7 +151,7 @@ def update_chunk(
149151
nodes = list(CHILDREN.keys())
150152
random.shuffle(nodes)
151153
nodes_ts = cg.get_node_timestamps(nodes, return_numpy=False, normalize=True)
152-
_populate_cx_edges_with_timestamps(cg, layer, nodes, earliest_ts)
154+
_populate_cx_edges_with_timestamps(cg, layer, nodes, nodes_ts, earliest_ts)
153155

154156
task_size = int(math.ceil(len(nodes) / mp.cpu_count() / 2))
155157
chunked_nodes = chunked(nodes, task_size)

0 commit comments

Comments
 (0)