Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(interactive): Refine generate_sdk.sh for interactive #3807

Merged
merged 6 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions flex/engines/http_server/handler/hqps_http_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ seastar::future<std::unique_ptr<seastar::httpd::reply>> hqps_ic_handler::handle(

return executor_refs_[dst_executor]
.run_graph_db_query(query_param{std::move(req->content)})
.then([this, outer_span = outer_span](auto&& output) {
.then([this
#ifdef HAVE_OPENTELEMETRY_CPP
,
outer_span = outer_span
#endif // HAVE_OPENTELEMETRY_CPP
](auto&& output) {
if (output.content.size() < 4) {
LOG(ERROR) << "Invalid output size: " << output.content.size();
#ifdef HAVE_OPENTELEMETRY_CPP
Expand All @@ -132,7 +137,7 @@ seastar::future<std::unique_ptr<seastar::httpd::reply>> hqps_ic_handler::handle(
outer_span->End();
std::map<std::string, std::string> labels = {{"status", "fail"}};
total_counter_->Add(1, labels);
#endif
#endif // HAVE_OPENTELEMETRY_CPP
return seastar::make_ready_future<query_param>(std::move(output));
}
return seastar::make_ready_future<query_param>(
Expand Down Expand Up @@ -340,16 +345,25 @@ hqps_adhoc_query_handler::handle(const seastar::sstring& path,
param.content.append(gs::Schema::HQPS_ADHOC_PLUGIN_ID_STR, 1);
return executor_refs_[dst_executor]
.run_graph_db_query(query_param{std::move(param.content)})
.then([query_span = query_span,
query_scope = std::move(query_scope)](auto&& output) {
.then([
#ifdef HAVE_OPENTELEMETRY_CPP
query_span = query_span,
query_scope = std::move(query_scope)
#endif // HAVE_OPENTELEMETRY_CPP
](auto&& output) {
#ifdef HAVE_OPENTELEMETRY_CPP
query_span->End();
#endif // HAVE_OPENTELEMETRY_CPP
return seastar::make_ready_future<query_param>(
std::move(output.content));
});
})
.then([this, outer_span = outer_span](auto&& output) {
.then([this
#ifdef HAVE_OPENTELEMETRY_CPP
,
outer_span = outer_span
#endif // HAVE_OPENTELEMETRY_CPP
](auto&& output) {
if (output.content.size() < 4) {
LOG(ERROR) << "Invalid output size: " << output.content.size();
#ifdef HAVE_OPENTELEMETRY_CPP
Expand Down
53 changes: 45 additions & 8 deletions flex/interactive/sdk/generate_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,54 @@ if [ $# -eq 0 ]; then
fi

function install_generator() {
# first check openapi-generator-cli is executable
CLI_INSTALLED=false
JQ_INSTALLED=false
MVN_INSTALLED=false
# first check openapi-generator-cli exists is executable
if [ -f ~/bin/openapitools/openapi-generator-cli ]; then
echo "openapi-generator-cli is already installed"
export PATH=$PATH:~/bin/openapitools/
fi
if command -v openapi-generator-cli &>/dev/null; then
echo "openapi-generator-cli is already installed"
return
CLI_INSTALLED=true
fi
if ! $CLI_INSTALLED; then
echo "Installing openapi-generator-cli"
mkdir -p ~/bin/openapitools
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli
chmod u+x ~/bin/openapitools/openapi-generator-cli
export PATH=$PATH:~/bin/openapitools/
export OPENAPI_GENERATOR_VERSION=7.2.0
fi
# on ubuntu apt-get jq on mac brew install jq

if command -v jq &>/dev/null; then
echo "jq is already installed"
JQ_INSTALLED=true
fi
if command -v mvn &>/dev/null; then
echo "maven is already installed"
MVN_INSTALLED=true
fi
if [[ "$(uname -s)" == "Linux" ]]; then
if ! $JQ_INSTALLED; then
sudo apt-get update && sudo apt-get -y install jq
fi
if ! $MVN_INSTALLED; then
sudo apt-get update && sudo apt-get -y install maven
fi
elif [[ "$(uname -s)" == "Darwin" ]]; then
if ! $JQ_INSTALLED; then
brew install jq
fi
if ! $MVN_INSTALLED; then
brew install maven
fi
else
echo "Unsupported OS"
exit 1
fi
mkdir -p ~/bin/openapitools
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli
chmod u+x ~/bin/openapitools/openapi-generator-cli
export PATH=$PATH:~/bin/openapitools/
export OPENAPI_GENERATOR_VERSION=7.2.0
sudo apt-get update && sudo apt-get -y install jq
}

install_generator
Expand Down
Loading