From 38161c4dd50fde375b8fcd8ceb40ffbad285064f Mon Sep 17 00:00:00 2001 From: wxyu Date: Sat, 24 Aug 2019 16:44:30 +0800 Subject: [PATCH] MS-417 YAML sequence load disable cause scheduler startup failed Former-commit-id: e1929059c6e5554a329a717b490beb3efa2c97bb --- cpp/CHANGELOG.md | 1 + cpp/src/config/YamlConfigMgr.cpp | 30 +++++++++++++++--------------- cpp/src/config/YamlConfigMgr.h | 8 ++++---- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index ce3957e8..12906a4b 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -8,6 +8,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-411 - Fix metric unittest linking error - MS-412 - Fix gpu cache logical error - MS-416 - ExecutionEngineImpl::GpuCache has not return value cause crash +- MS-417 - YAML sequence load disable cause scheduler startup failed ## Improvement - MS-327 - Clean code for milvus diff --git a/cpp/src/config/YamlConfigMgr.cpp b/cpp/src/config/YamlConfigMgr.cpp index ee935bf3..9a34ef3e 100644 --- a/cpp/src/config/YamlConfigMgr.cpp +++ b/cpp/src/config/YamlConfigMgr.cpp @@ -73,19 +73,19 @@ YamlConfigMgr::SetChildConfig(const YAML::Node& node, return false; } -//bool -//YamlConfigMgr::SetSequence(const YAML::Node &node, -// const std::string &child_name, -// ConfigNode &config) { -// if(node[child_name].IsDefined ()) { -// size_t cnt = node[child_name].size(); -// for(size_t i = 0; i < cnt; i++){ -// config.AddSequenceItem(child_name, node[child_name][i].as()); -// } -// return true; -// } -// return false; -//} +bool +YamlConfigMgr::SetSequence(const YAML::Node &node, + const std::string &child_name, + ConfigNode &config) { + if(node[child_name].IsDefined ()) { + size_t cnt = node[child_name].size(); + for(size_t i = 0; i < cnt; i++){ + config.AddSequenceItem(child_name, node[child_name][i].as()); + } + return true; + } + return false; +} void YamlConfigMgr::LoadConfigNode(const YAML::Node& node, ConfigNode& config) { @@ -98,8 +98,8 @@ YamlConfigMgr::LoadConfigNode(const YAML::Node& node, ConfigNode& config) { SetConfigValue(node, key, config); } else if(node[key].IsMap()){ SetChildConfig(node, key, config); -// } else if(node[key].IsSequence()){ -// SetSequence(node, key, config); + } else if(node[key].IsSequence()){ + SetSequence(node, key, config); } } } diff --git a/cpp/src/config/YamlConfigMgr.h b/cpp/src/config/YamlConfigMgr.h index 05b55d9d..b8828b7a 100644 --- a/cpp/src/config/YamlConfigMgr.h +++ b/cpp/src/config/YamlConfigMgr.h @@ -33,10 +33,10 @@ class YamlConfigMgr : public IConfigMgr { const std::string &name, ConfigNode &config); -// bool -// SetSequence(const YAML::Node &node, -// const std::string &child_name, -// ConfigNode &config); + bool + SetSequence(const YAML::Node &node, + const std::string &child_name, + ConfigNode &config); void LoadConfigNode(const YAML::Node& node, ConfigNode& config); -- GitLab