Skip to content

Commit

Permalink
fix(interactive): Fix parsing empty edge_type list when creation graph (
Browse files Browse the repository at this point in the history
#3902)

As titled.

---------

Co-authored-by: Dongze Li <[email protected]>
  • Loading branch information
zhanglei1949 and lidongze0629 authored Jun 12, 2024
1 parent dd8eb59 commit 591b092
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
4 changes: 4 additions & 0 deletions flex/storages/rt_mutable_graph/schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,10 @@ static Status parse_edge_schema(YAML::Node node, Schema& schema) {
}

static Status parse_edges_schema(YAML::Node node, Schema& schema) {
if (node.IsNull()){
LOG(INFO) << "No edge is set";
return Status::OK();
}
if (!node.IsSequence()) {
LOG(ERROR) << "edge is not set properly";
return Status(StatusCode::InvalidSchema, "edge is not set properly");
Expand Down
18 changes: 16 additions & 2 deletions python/graphscope/gsctl/gsctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,25 @@
0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..")
)

from graphscope.gsctl.commands import get_command_collection
from graphscope.gsctl.config import get_current_context
try:
import graphscope
from graphscope.gsctl.commands import get_command_collection
from graphscope.gsctl.config import get_current_context
except ModuleNotFoundError:
# if graphscope is not installed, only basic functions or utilities
# can be used, e.g. install dependencies
graphscope = None


def cli():
if graphscope is None:
sys.path.insert(
0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "commands")
)
from dev import cli as dev_cli

dev_cli()

context = get_current_context()
# get the specified commands under the FLEX architecture
commands = get_command_collection(context)
Expand Down
38 changes: 38 additions & 0 deletions python/graphscope/gsctl/tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,34 @@
},
}

modern_graph_vertex_only = {
"name": "modern_graph",
"description": "This is a test graph, only contains vertex",
"schema": {
"vertex_types": [
{
"type_name": "person",
"properties": [
{
"property_name": "id",
"property_type": {"primitive_type": "DT_SIGNED_INT64"},
},
{
"property_name": "name",
"property_type": {"string": {"long_text": ""}},
},
{
"property_name": "age",
"property_type": {"primitive_type": "DT_SIGNED_INT32"},
},
],
"primary_keys": ["id"],
}
],
"edge_types": [],
},
}


modern_graph_datasource = {
"vertex_mappings": [
Expand Down Expand Up @@ -355,5 +383,15 @@ def test_suit_case(self):
assert stored_procedure_id == "procedure_name"
delete_graph_by_id(graph_id_2)

def test_start_service_on_vertex_only_graph(self):
graph_id = create_graph(modern_graph_vertex_only)
start_service(graph_id)
status = list_service_status()
for s in status:
if s.graph_id == graph_id:
assert s.status == "Running"
else:
assert s.status == "Stopped"

def teardown_class(self):
disconnect_coordinator()

0 comments on commit 591b092

Please sign in to comment.