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

Method get_dag_for_unload

python/graphscope/client/session.py:195–213  ·  view source on GitHub ↗

Unload operations (graph, app, context) in dag which are not existed in fetches.

(self)

Source from the content-addressed store, hash-verified

193 return rets[0] if rets and self._unpack else rets
194
195 def get_dag_for_unload(self):
196 """Unload operations (graph, app, context) in dag which are not
197 existed in fetches.
198 """
199 unload_dag = op_def_pb2.DagDef()
200 keys_of_fetches = set([op.key for op in self._ops])
201 mapping = {
202 types_pb2.CREATE_GRAPH: types_pb2.UNLOAD_GRAPH,
203 types_pb2.CREATE_APP: types_pb2.UNLOAD_APP,
204 types_pb2.RUN_APP: types_pb2.UNLOAD_CONTEXT,
205 }
206 for op_def in self._sub_dag.op:
207 if op_def.op in mapping and op_def.key not in keys_of_fetches:
208 unload_op_def = op_def_pb2.OpDef(
209 op=mapping[op_def.op], key=uuid.uuid4().hex
210 )
211 unload_op_def.parents.extend([op_def.key])
212 unload_dag.op.extend([unload_op_def])
213 return unload_dag
214
215
216class Session(object):

Callers 1

run_fetchesMethod · 0.80

Calls 1

extendMethod · 0.45

Tested by

no test coverage detected