Skip to content

Commit

Permalink
Fix restart test of GraphScope-Store(#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianliplus authored Sep 8, 2021
1 parent 42a9e8e commit dc8f214
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,17 @@ jobs:
python3 -m pytest -s -vvv tests/kubernetes/test_store_service.py -k test_demo_fresh
# helm restart ci release and run demo with the PersistentVolume
# FIXME(@haixia): restart seems not work.
# helm uninstall ci
# cd ${GITHUB_WORKSPACE}/charts
# helm install ci --set image.tag=${{ github.sha }},executor=${{ matrix.executor }} \
# ./graphscope-store
# helm test ci --timeout 5m0s
# cd ${GITHUB_WORKSPACE}/python
# python3 -m pytest -s -vvv tests/kubernetes/test_store_service.py -k test_demo_after_restart
helm uninstall ci
cd ${GITHUB_WORKSPACE}/charts
helm install ci --set image.tag=${{ github.sha }},executor=${{ matrix.executor }} \
./graphscope-store
export GRPC_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services ci-graphscope-store-frontend)
export GREMLIN_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[1].nodePort}" services ci-graphscope-store-frontend)
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
helm test ci --timeout 5m0s
cd ${GITHUB_WORKSPACE}/python
sleep 30
python3 -m pytest -s -vvv tests/kubernetes/test_store_service.py -k test_demo_after_restart
- name: Clean
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.alibaba.maxgraph.v2.common.SnapshotListener;
import com.alibaba.maxgraph.v2.common.SnapshotWithSchema;
import com.alibaba.maxgraph.v2.common.exception.MaxGraphException;
import com.alibaba.maxgraph.v2.common.frontend.api.schema.SchemaFetcher;
import com.alibaba.maxgraph.v2.common.frontend.api.schema.SnapshotSchema;
import com.alibaba.maxgraph.v2.common.schema.GraphDef;
Expand Down Expand Up @@ -130,6 +131,10 @@ public SnapshotSchema fetchSchema() {
if (snapshotWithSchema == null) {
return null;
}
return new SnapshotSchema(snapshotWithSchema.getSnapshotId(), snapshotWithSchema.getGraphDef());
long snapshotId = snapshotWithSchema.getSnapshotId();
if (snapshotId == -1L) {
throw new MaxGraphException("Not started yet");
}
return new SnapshotSchema(snapshotId, snapshotWithSchema.getGraphDef());
}
}
17 changes: 12 additions & 5 deletions python/graphscope/framework/graph_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def as_type_def(self):
@classmethod
def from_type_def(cls, pb):
label = cls(pb.label)
label._label_id = pb.label_id
label._label_id = pb.label_id.id
label._version_id = pb.version_id
for prop_pb in pb.props:
label._props.append(Property.from_property_def(prop_pb))
Expand Down Expand Up @@ -240,12 +240,19 @@ def _from_store_service(self, graph_def):
"""
self._vertex_labels.clear()
self._edge_labels.clear()
id_to_label = {}
for type_def_pb in graph_def.type_defs:
id_to_label[type_def_pb.label_id.id] = type_def_pb.label
edge_kinds = {}
for kind in graph_def.edge_kinds:
if kind.edge_label not in edge_kinds:
edge_kinds[kind.edge_label] = []
edge_kinds[kind.edge_label].append(
(kind.src_vertex_label, kind.dst_vertex_label)
edge_label = id_to_label[kind.edge_label_id.id]
if edge_label not in edge_kinds:
edge_kinds[edge_label] = []
edge_kinds[edge_label].append(
(
id_to_label[kind.src_vertex_label_id.id],
id_to_label[kind.dst_vertex_label_id.id],
)
)
for type_def_pb in graph_def.type_defs:
if type_def_pb.type_enum == graph_def_pb2.VERTEX:
Expand Down

0 comments on commit dc8f214

Please sign in to comment.