Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the pre-genereated unload_op when the op itself been deepcopied #2888

Merged
merged 1 commit into from
Jun 14, 2023
Merged
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
4 changes: 2 additions & 2 deletions python/graphscope/client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def __init__(
# "vineyard_socket": "...",
# "vineyard_rpc_endpoint": "..."
# }
self._engine_config: {} = None
self._engine_config: dict = None

# interactive instance related graph map
self._interactive_instance_dict = {}
Expand Down Expand Up @@ -713,7 +713,7 @@ def session_id(self) -> str:
return self._session_id

@property
def dag(self):
def dag(self) -> Dag:
return self._dag

def _log_session_info(self):
Expand Down
1 change: 1 addition & 0 deletions python/graphscope/framework/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def __init__(self, app_node, key):
# copy and set op evaluated
self._app_node.op = deepcopy(self._app_node.op)
self._app_node.evaluated = True
self._app_node._unload_op = unload_app(self._app_node)
self._session.dag.add_op(self._app_node.op)
self._saved_signature = self.signature

Expand Down
1 change: 1 addition & 0 deletions python/graphscope/framework/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ def __init__(self, context_node, key, result_schema):
# copy and set op evaluated
self._context_node.op = deepcopy(self._context_node.op)
self._context_node.evaluated = True
self._context_node._unload_op = dag_utils.unload_context(self._context_node)
self._saved_signature = self.signature

@property
Expand Down
11 changes: 9 additions & 2 deletions python/graphscope/framework/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,12 @@ def __init__(
self._resolve_op(incoming_data)
self._session.dag.add_op(self._op)

# statically create the unload op
self._unload_op = dag_utils.unload_graph(self)
# statically create the unload op, as the op may change, the
# unload op should be refreshed as well.
if self._op is None:
self._unload_op = None
else:
self._unload_op = dag_utils.unload_graph(self)

@property
def v_labels(self):
Expand Down Expand Up @@ -377,6 +381,8 @@ def _resolve_op(self, incoming_data):
self._op = self._from_nx_graph(incoming_data)
else:
raise RuntimeError("Not supported incoming data.")
# update the unload op
self._unload_op = dag_utils.unload_graph(self)

def to_numpy(self, selector, vertex_range=None):
"""Select some elements of the graph and output to numpy.
Expand Down Expand Up @@ -806,6 +812,7 @@ def __init__(
# copy and set op evaluated
self._graph_node.op = deepcopy(self._graph_node.op)
self._graph_node.evaluated = True
self._graph_node._unload_op = dag_utils.unload_graph(self._graph_node)
self._session.dag.add_op(self._graph_node.op)

self._key = None
Expand Down
3 changes: 3 additions & 0 deletions python/graphscope/nx/classes/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ def __init__(self, incoming_graph_data=None, default_label=None, **attr):
self._is_client_view = False

# statically create the unload op
#
# networkx operations update the op, but keep the key as same, thus
# the unload op don't need to be refreshed.
if self.op is None:
self._unload_op = None
else:
Expand Down