MCPcopy Create free account
hub / github.com/alibaba/GraphScope / split

Method split

python/graphscope/client/utils.py:63–91  ·  view source on GitHub ↗

Traverse `large_attr` of op and split into a list of chunks. Note that this method will modify `large_attr` attribute of op in dag_def. Returns: Sequence[Sequence[bytes]]: splited chunks.

(self, dag_def)

Source from the content-addressed store, hash-verified

61 return chunk_meta
62
63 def split(self, dag_def):
64 """Traverse `large_attr` of op and split into a list of chunks.
65
66 Note that this method will modify `large_attr` attribute of op in dag_def.
67
68 Returns:
69 Sequence[Sequence[bytes]]: splited chunks.
70 """
71 chunks_list = []
72 for op in dag_def.op:
73 large_attr = attr_value_pb2.LargeAttrValue()
74 for chunk in op.large_attr.chunk_list.items:
75 # construct chunk meta
76 large_attr.chunk_meta_list.items.extend(
77 [self._generate_chunk_meta(chunk)]
78 )
79 # split buffer
80 chunks_list.append(
81 (
82 [
83 chunk.buffer[i : i + self.CHUNK_SIZE]
84 for i in range(0, len(chunk.buffer), self.CHUNK_SIZE)
85 ],
86 op.key,
87 )
88 )
89 # replace chunk with chunk_meta
90 op.large_attr.CopyFrom(large_attr)
91 return chunks_list
92
93 def generate_runstep_requests(self, session_id, dag_def):
94 runstep_requests = []

Callers 15

mainFunction · 0.80
init_host_and_portMethod · 0.80
__init__Method · 0.80
initHostPortMethod · 0.80
post_setupMethod · 0.80
version.pyFile · 0.80
_stream_log_implMethod · 0.80
delete_kubernetes_objectFunction · 0.80
get_roleMethod · 0.80
get_cluster_roleMethod · 0.80

Calls 4

_generate_chunk_metaMethod · 0.95
appendMethod · 0.65
extendMethod · 0.45
CopyFromMethod · 0.45

Tested by 10

test_multiple_sessionFunction · 0.64
compare_resultFunction · 0.64
compare_idFunction · 0.64
test_edge_traversalFunction · 0.64
getPropertiesMethod · 0.64
test_ldbc_parseFunction · 0.64
loadVineyardDataTestMethod · 0.64
propertiesTestMethod · 0.64