Skip to content

Commit

Permalink
fixing hqps ci
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanglei1949 committed Jun 14, 2024
1 parent 7e9d687 commit 8ec0447
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 8 deletions.
59 changes: 55 additions & 4 deletions flex/engines/http_server/actor/admin_actor.act.cc
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,13 @@ seastar::future<admin_query_result> admin_actor::run_get_graph_meta(
add_runnable_info(plugin_meta);
}
auto& graph_meta = meta_res.value();
graph_meta.plugin_metas = all_plugin_metas;
// There can also be procedures that builtin in the graph meta.
for (auto& plugin_meta : graph_meta.plugin_metas) {
add_runnable_info(plugin_meta);
}
graph_meta.plugin_metas.insert(graph_meta.plugin_metas.end(),
all_plugin_metas.begin(),
all_plugin_metas.end());
return seastar::make_ready_future<admin_query_result>(
gs::Result<seastar::sstring>(std::move(graph_meta.ToJson())));
} else {
Expand Down Expand Up @@ -694,6 +700,12 @@ seastar::future<admin_query_result> admin_actor::get_procedures_by_graph_name(
for (auto& plugin_meta : all_plugin_metas) {
add_runnable_info(plugin_meta);
}
for (auto& plugin_meta : graph_meta_res.value().plugin_metas) {
add_runnable_info(plugin_meta);
}
all_plugin_metas.insert(all_plugin_metas.end(),
graph_meta_res.value().plugin_metas.begin(),
graph_meta_res.value().plugin_metas.end());
return seastar::make_ready_future<admin_query_result>(
gs::Result<seastar::sstring>(to_json_str(all_plugin_metas)));
} else {
Expand Down Expand Up @@ -1123,13 +1135,52 @@ seastar::future<admin_query_result> admin_actor::service_status(
res["bolt_port"] = hqps_service.get_service_config().bolt_port;
res["gremlin_port"] = hqps_service.get_service_config().gremlin_port;
if (running_graph_res.ok()) {
auto graph_meta =
auto graph_meta_res =
metadata_store_->GetGraphMeta(running_graph_res.value());
if (graph_meta.ok()) {
res["graph"] = nlohmann::json::parse(graph_meta.value().ToJson());
if (graph_meta_res.ok()) {
auto& graph_meta = graph_meta_res.value();
// Add the plugin meta.
auto get_all_procedure_res =
metadata_store_->GetAllPluginMeta(running_graph_res.value());
if (get_all_procedure_res.ok()) {
VLOG(10) << "Successfully get all procedures: "
<< get_all_procedure_res.value().size();
auto& all_plugin_metas = get_all_procedure_res.value();
VLOG(10) << "original all plugins : " << all_plugin_metas.size();
for (auto& plugin_meta : all_plugin_metas) {
add_runnable_info(plugin_meta);
}
for (auto& plugin_meta : graph_meta.plugin_metas) {
add_runnable_info(plugin_meta);
}

VLOG(10) << "original graph meta: " << graph_meta.plugin_metas.size();
for (auto& plugin_meta : all_plugin_metas) {
if (plugin_meta.runnable) {
graph_meta.plugin_metas.emplace_back(plugin_meta);
}
}
VLOG(10) << "got graph meta: " << graph_meta.ToJson();
res["graph"] = nlohmann::json::parse(graph_meta.ToJson());
} else {
LOG(ERROR) << "Fail to get all procedures: "
<< get_all_procedure_res.status().error_message();
return seastar::make_exception_future<admin_query_result>(
get_all_procedure_res.status());
}
} else {
LOG(ERROR) << "Fail to get graph meta: "
<< graph_meta_res.status().error_message();
res["graph"] = {};
return seastar::make_exception_future<admin_query_result>(
graph_meta_res.status());
}
} else {
res["graph"] = {};
LOG(ERROR) << "Fail to get running graph: "
<< running_graph_res.status().error_message();
return seastar::make_exception_future<admin_query_result>(
running_graph_res.status());
}
res["start_time"] = hqps_service.get_start_time();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def __init__(self, uri: str):
# get service port
service_status = self.get_service_status()
if not service_status.is_ok():
raise Exception("Failed to get service status")
raise Exception("Failed to get service status: ", service_status.get_status_message())
service_port = service_status.get_value().hqps_port
# replace the port in uri
uri = uri.split(":")
Expand Down
2 changes: 2 additions & 0 deletions flex/openapi/openapi_interactive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,8 @@ components:
type: boolean
creation_time:
type: integer
update_time:
type: integer
UpdateProcedureRequest:
x-body-name: update_procedure_request
type: object
Expand Down
5 changes: 5 additions & 0 deletions flex/storages/metadata/graph_meta_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ PluginMeta PluginMeta::FromJson(const nlohmann::json& json) {
}
if (json.contains("name")) {
meta.name = json["name"].get<std::string>();
if (meta.id.empty()) {
meta.id = meta.name;
}
}
if (json.contains("bound_graph")) {
meta.bound_graph = json["bound_graph"].get<GraphId>();
Expand All @@ -155,6 +158,8 @@ PluginMeta PluginMeta::FromJson(const nlohmann::json& json) {
}
if (json.contains("type")) {
meta.type = json["type"].get<std::string>();
} else {
meta.type = "cpp"; // default is cpp
}
if (json.contains("option")) {
meta.setOptionFromJsonString(json["option"].dump());
Expand Down
18 changes: 15 additions & 3 deletions flex/tests/interactive/test_plugin_loading.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,22 @@ kill_service(){
trap kill_service EXIT

start_engine_service(){
# expect one args
if [ $# -lt 1 ]; then
echo "Receives: $# args, need 1 args"
echo "Usage: $0 <ENABLE_COMPILER>"
exit 1
fi
enable_compiler=$1
#check SERVER_BIN exists
if [ ! -f ${SERVER_BIN} ]; then
err "SERVER_BIN not found"
exit 1
fi
cmd="${SERVER_BIN} -w ${WORKSPACE} -c ${ENGINE_CONFIG_PATH} --enable-admin-service true"
cmd="${cmd} --start-compiler true"
if [ "${enable_compiler}" == "true" ]; then
cmd="${cmd} --start-compiler true"
fi

echo "Start engine service with command: ${cmd}"
${cmd} &
Expand Down Expand Up @@ -93,7 +102,7 @@ check_procedure_loading_and_calling_via_encoder() {
exit 1
fi
cp $1 ${WORKSPACE}/data/${GRAPH_NAME}/graph.yaml
start_engine_service
start_engine_service false

python3 test_call_proc.py --endpoint http://localhost:7777 --input-format encoder

Expand All @@ -108,16 +117,19 @@ check_procedure_loading_and_calling_via_cypher_json() {
exit 1
fi
cp $1 ${WORKSPACE}/data/${GRAPH_NAME}/graph.yaml
start_engine_service
start_engine_service true

sleep 5
python3 test_call_proc.py --endpoint http://localhost:7777 --input-format json

kill_service
}

echo "Testing for schema file: ${SCHEMA_VERSION_00}"
rm -rf ${WORKSPACE}/METADATA/
check_procedure_loading_and_calling_via_encoder ${SCHEMA_VERSION_00}
echo "Testing for schema file: ${SCHEMA_VERSION_01}"
rm -rf ${WORKSPACE}/METADATA/
check_procedure_loading_and_calling_via_cypher_json ${SCHEMA_VERSION_01}

echo "Test passed for plugin loading and calling"

0 comments on commit 8ec0447

Please sign in to comment.