提交 85b099b1 编写于 作者: W wangjiawei04

precommit resource.cpp

上级 ed9cfee7
...@@ -144,14 +144,17 @@ int Resource::initialize(const std::string& path, const std::string& file) { ...@@ -144,14 +144,17 @@ int Resource::initialize(const std::string& path, const std::string& file) {
return -1; return -1;
} }
// init rocksDB or cube instance // init rocksDB or cube instance
if (resource_conf.has_cube_config_file() && resource_conf.has_cube_config_path()) { if (resource_conf.has_cube_config_file() &&
resource_conf.has_cube_config_path()) {
LOG(INFO) << "init cube client, path[ " << resource_conf.cube_config_path() LOG(INFO) << "init cube client, path[ " << resource_conf.cube_config_path()
<< " ], config file [ " << resource_conf.cube_config_file() << " ]."; << " ], config file [ " << resource_conf.cube_config_file()
rec::mcube::CubeAPI *cube = rec::mcube::CubeAPI::instance(); << " ].";
std::string cube_config_fullpath = "./" + resource_conf.cube_config_path() +"/" + resource_conf.cube_config_file(); rec::mcube::CubeAPI* cube = rec::mcube::CubeAPI::instance();
std::string cube_config_fullpath = "./" + resource_conf.cube_config_path() +
"/" + resource_conf.cube_config_file();
this->cube_config_fullpath = cube_config_fullpath; this->cube_config_fullpath = cube_config_fullpath;
} }
if (db.get() == nullptr) { if (db.get() == nullptr) {
db = RocksDBWrapper::RocksDBWrapperFactory("kvdb"); db = RocksDBWrapper::RocksDBWrapperFactory("kvdb");
} }
...@@ -166,7 +169,7 @@ int Resource::general_model_initialize(const std::string& path, ...@@ -166,7 +169,7 @@ int Resource::general_model_initialize(const std::string& path,
// TODO: add serving dist op detection, if true, add cube instance init. // TODO: add serving dist op detection, if true, add cube instance init.
if (this->cube_config_fullpath.size() != 0) { if (this->cube_config_fullpath.size() != 0) {
LOG(INFO) << "init cube by config file : " << this->cube_config_fullpath; LOG(INFO) << "init cube by config file : " << this->cube_config_fullpath;
rec::mcube::CubeAPI *cube = rec::mcube::CubeAPI::instance(); rec::mcube::CubeAPI* cube = rec::mcube::CubeAPI::instance();
cube->init(this->cube_config_fullpath.c_str()); cube->init(this->cube_config_fullpath.c_str());
} }
VLOG(2) << "general model path: " << path; VLOG(2) << "general model path: " << path;
...@@ -211,13 +214,10 @@ int Resource::general_model_initialize(const std::string& path, ...@@ -211,13 +214,10 @@ int Resource::general_model_initialize(const std::string& path,
for (int i = 0; i < feed_var_num; ++i) { for (int i = 0; i < feed_var_num; ++i) {
_config->_feed_name[i] = model_config.feed_var(i).name(); _config->_feed_name[i] = model_config.feed_var(i).name();
_config->_feed_alias_name[i] = model_config.feed_var(i).alias_name(); _config->_feed_alias_name[i] = model_config.feed_var(i).alias_name();
VLOG(2) << "feed var[" << i << "]: " VLOG(2) << "feed var[" << i << "]: " << _config->_feed_name[i];
<< _config->_feed_name[i]; VLOG(2) << "feed var[" << i << "]: " << _config->_feed_alias_name[i];
VLOG(2) << "feed var[" << i << "]: "
<< _config->_feed_alias_name[i];
_config->_feed_type[i] = model_config.feed_var(i).feed_type(); _config->_feed_type[i] = model_config.feed_var(i).feed_type();
VLOG(2) << "feed type[" << i << "]: " VLOG(2) << "feed type[" << i << "]: " << _config->_feed_type[i];
<< _config->_feed_type[i];
if (model_config.feed_var(i).is_lod_tensor()) { if (model_config.feed_var(i).is_lod_tensor()) {
VLOG(2) << "var[" << i << "] is lod tensor"; VLOG(2) << "var[" << i << "] is lod tensor";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册