From 0472209cf5cdf28559f47fc0ac795417e873916c Mon Sep 17 00:00:00 2001 From: Surfacebuaa <408083193@qq.com> Date: Mon, 26 Aug 2024 15:06:43 +0800 Subject: [PATCH 1/2] feat: support reading local file path from environment variable --- ic_impl/util.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ic_impl/util.cc b/ic_impl/util.cc index fa63325..56c7bdd 100644 --- a/ic_impl/util.cc +++ b/ic_impl/util.cc @@ -142,14 +142,17 @@ char* GetParamEnv(std::string_view env_name) { namespace { std::optional GetIoFileNameFromEnv(bool input) { - char* host_url = std::getenv("system.storage"); - if (!host_url || !absl::StartsWith(host_url, "file://")) { - host_url = std::getenv("system.storage.host.url"); + char* host_url = std::getenv("system.storage"); if (!host_url || !absl::StartsWith(host_url, "file://")) { - return std::nullopt; + host_url = std::getenv("system.storage.host.url"); + if (!host_url) { + host_url = std::getenv("system.storage.localfile"); + } + if (!host_url || !absl::StartsWith(host_url, "file://")) { + return std::nullopt; + } } - } - std::string_view root_path = host_url + 6; + std::string_view root_path = host_url + 6; char* json_str = nullptr; if (input) { From 20371146a23eb79d2d8125c7d800634d0d3bb4a2 Mon Sep 17 00:00:00 2001 From: Surfacebuaa <408083193@qq.com> Date: Mon, 26 Aug 2024 15:09:11 +0800 Subject: [PATCH 2/2] feat: add timeout parameters --- ic_impl/util.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ic_impl/util.cc b/ic_impl/util.cc index 56c7bdd..c39e9f1 100644 --- a/ic_impl/util.cc +++ b/ic_impl/util.cc @@ -45,17 +45,19 @@ void StartTransport() { } // namespace std::shared_ptr CreateLinkContextForBlackBox() { - yacl::link::ContextDesc desc; - desc.brpc_channel_protocol = "http"; - size_t self_rank; - yacl::link::FactoryBrpcBlackBox::GetPartyNodeInfoFromEnv(desc.parties, - self_rank); - - if (util::GetParamEnv("start_transport", false)) { - StartTransport(); - } + yacl::link::ContextDesc desc; + desc.brpc_channel_protocol = "http"; + size_t self_rank; + yacl::link::FactoryBrpcBlackBox::GetPartyNodeInfoFromEnv(desc.parties, self_rank); + desc.connect_retry_times = util::GetParamEnv("connect_retry_times", 3600); + desc.connect_retry_interval_ms = util::GetParamEnv("connect_retry_interval_ms", 5000); + desc.recv_timeout_ms = util::GetParamEnv("recv_timeout_ms", 3600000); + + if (util::GetParamEnv("start_transport", false)) { + StartTransport(); + } - return yacl::link::FactoryBrpcBlackBox().CreateContext(desc, self_rank); + return yacl::link::FactoryBrpcBlackBox().CreateContext(desc, self_rank); } std::shared_ptr CreateLinkContextForWhiteBox(