Skip to content

Commit

Permalink
Unload graph when session close (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidongze0629 authored Feb 9, 2021
1 parent 3081a8a commit 567e3dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions analytical_engine/core/grape_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ bl::result<rpc::GraphDef> GrapeInstance::loadGraph(
graph_def.set_key(graph_name);
graph_def.set_directed(directed);
graph_def.set_graph_type(rpc::DYNAMIC_PROPERTY);
// dynamic graph doesn't have a vineyard id
graph_def.set_vineyard_id(-1);
auto* schema_def = graph_def.mutable_schema_def();

schema_def->set_oid_type(
Expand Down
6 changes: 6 additions & 0 deletions coordinator/gscoordinator/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def RunStep(self, request, context): # noqa: C901
response.graph_def.key,
GraphMeta(
response.graph_def.key,
response.graph_def.vineyard_id,
response.graph_def.schema_def,
schema_path,
),
Expand Down Expand Up @@ -566,6 +567,11 @@ def _cleanup(self, is_dangling=False):
s=obj.key.encode("utf-8")
)
}
# dynamic graph doesn't have a vineyard id
if obj.vineyard_id != -1:
config[types_pb2.VINEYARD_ID] = attr_value_pb2.AttrValue(
i=obj.vineyard_id
)

if unload_type:
dag_def = create_single_op_dag(unload_type, config)
Expand Down
3 changes: 2 additions & 1 deletion coordinator/gscoordinator/object_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ def __init__(self, key, type, lib_path):


class GraphMeta(object):
def __init__(self, key, schema, schema_path=None):
def __init__(self, key, vineyard_id, schema, schema_path=None):
self.key = key
self.type = "graph"
self.vineyard_id = vineyard_id
self.schema = schema
self.schema_path = schema_path

Expand Down

0 comments on commit 567e3dc

Please sign in to comment.