diff --git a/flex/engines/http_server/actor/admin_actor.act.cc b/flex/engines/http_server/actor/admin_actor.act.cc index f810e34679a2..682856e793f8 100644 --- a/flex/engines/http_server/actor/admin_actor.act.cc +++ b/flex/engines/http_server/actor/admin_actor.act.cc @@ -485,7 +485,13 @@ seastar::future 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( gs::Result(std::move(graph_meta.ToJson()))); } else { @@ -694,6 +700,12 @@ seastar::future 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( gs::Result(to_json_str(all_plugin_metas))); } else { @@ -1123,13 +1135,52 @@ seastar::future 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( + 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( + 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( + running_graph_res.status()); } res["start_time"] = hqps_service.get_start_time(); } else { diff --git a/flex/interactive/sdk/python/gs_interactive/client/session.py b/flex/interactive/sdk/python/gs_interactive/client/session.py index c1d821078bd8..79993c3560b1 100644 --- a/flex/interactive/sdk/python/gs_interactive/client/session.py +++ b/flex/interactive/sdk/python/gs_interactive/client/session.py @@ -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(":") diff --git a/flex/openapi/openapi_interactive.yaml b/flex/openapi/openapi_interactive.yaml index f12f76c8b4d3..42769c014bc6 100644 --- a/flex/openapi/openapi_interactive.yaml +++ b/flex/openapi/openapi_interactive.yaml @@ -1298,6 +1298,8 @@ components: type: boolean creation_time: type: integer + update_time: + type: integer UpdateProcedureRequest: x-body-name: update_procedure_request type: object diff --git a/flex/storages/metadata/graph_meta_store.cc b/flex/storages/metadata/graph_meta_store.cc index 7a202c48bfe2..44801276ab91 100644 --- a/flex/storages/metadata/graph_meta_store.cc +++ b/flex/storages/metadata/graph_meta_store.cc @@ -134,6 +134,9 @@ PluginMeta PluginMeta::FromJson(const nlohmann::json& json) { } if (json.contains("name")) { meta.name = json["name"].get(); + if (meta.id.empty()) { + meta.id = meta.name; + } } if (json.contains("bound_graph")) { meta.bound_graph = json["bound_graph"].get(); @@ -155,6 +158,8 @@ PluginMeta PluginMeta::FromJson(const nlohmann::json& json) { } if (json.contains("type")) { meta.type = json["type"].get(); + } else { + meta.type = "cpp"; // default is cpp } if (json.contains("option")) { meta.setOptionFromJsonString(json["option"].dump()); diff --git a/flex/tests/interactive/test_plugin_loading.sh b/flex/tests/interactive/test_plugin_loading.sh index 3c376ca6379d..d9b75c5fb48a 100644 --- a/flex/tests/interactive/test_plugin_loading.sh +++ b/flex/tests/interactive/test_plugin_loading.sh @@ -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 " + 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} & @@ -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 @@ -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" \ No newline at end of file