diff --git a/flex/bin/load_plan_and_gen.sh b/flex/bin/load_plan_and_gen.sh index e0f2d95ef555..93cb0116676c 100755 --- a/flex/bin/load_plan_and_gen.sh +++ b/flex/bin/load_plan_and_gen.sh @@ -608,8 +608,15 @@ run() { if [ ${ENGINE_TYPE} == "hqps" ]; then echo "Engine type is hqps, generating dynamic library for hqps engine." # if PROCEDURE_DESCRIPTION is not set, use empty string - if [ -z ${PROCEDURE_DESCRIPTION} ]; then + if [ -z "${PROCEDURE_DESCRIPTION}" ]; then PROCEDURE_DESCRIPTION="Automatic generated description for stored procedure ${PROCEDURE_NAME}." + else + # assume is a file, read the content + if [ -f ${PROCEDURE_DESCRIPTION} ]; then + PROCEDURE_DESCRIPTION=$(cat ${PROCEDURE_DESCRIPTION}) + else + PROCEDURE_DESCRIPTION="Automatic generated description for stored procedure ${PROCEDURE_NAME}." + fi fi # if PROCEDURE_NAME is not set, use input file name if [ -z "${PROCEDURE_NAME}" ]; then diff --git a/flex/engines/http_server/codegen_proxy.cc b/flex/engines/http_server/codegen_proxy.cc index a8b5d66a7710..3bd7a1932602 100644 --- a/flex/engines/http_server/codegen_proxy.cc +++ b/flex/engines/http_server/codegen_proxy.cc @@ -209,12 +209,16 @@ seastar::future> CodegenProxy::CallCodegenCmd( " -o=" + output_dir + " --procedure_name=" + query_name + " -w=" + work_dir + " --ir_conf=" + engine_config + " --graph_schema_path=" + graph_schema_path; + std::string desc_file = work_dir + "/" + query_name + ".desc"; if (!procedure_desc.empty()) { - cmd += " --procedure_desc=\'" + procedure_desc + "\'"; + std::ofstream ofs(desc_file); + ofs << procedure_desc; + ofs.close(); + cmd += " --procedure_desc=" + desc_file; } LOG(INFO) << "Start call codegen cmd: [" << cmd << "]"; - return hiactor::thread_resource_pool::submit_work([cmd] { + return hiactor::thread_resource_pool::submit_work([cmd, desc_file] { // auto res = std::system(cmd.c_str()); boost::process::ipstream stdout_pipe; boost::process::ipstream stderr_pipe; @@ -231,6 +235,10 @@ seastar::future> CodegenProxy::CallCodegenCmd( codegen_process.wait(); stderr_pipe.close(); stdout_pipe.close(); + // remove the desc file if exists + if (std::filesystem::exists(desc_file)) { + std::filesystem::remove(desc_file); + } int res = codegen_process.exit_code(); if (res != 0) { return gs::Result( diff --git a/flex/interactive/sdk/examples/python/basic_example.py b/flex/interactive/sdk/examples/python/basic_example.py index 2408700e5ec2..76be355e2562 100644 --- a/flex/interactive/sdk/examples/python/basic_example.py +++ b/flex/interactive/sdk/examples/python/basic_example.py @@ -299,6 +299,11 @@ def addEdge(sess: Session, graph_id: str): ) resp = sess.create_procedure(graph_id, create_proc_request) assert resp.is_ok() + + get_proc_res = sess.get_procedure(graph_id, "test_procedure") + assert get_proc_res.is_ok() + # Check the description of the procedure + assert get_proc_res.get_value().description == "test procedure" # must start service on the current graph, to let the procedure take effect resp = sess.restart_service()