MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / bg_load_patch

Method bg_load_patch

core/cube/cube-server/src/framework.cpp:264–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264int Framework::bg_load_patch(const std::string& v_path) {
265 int ret = bg_unload();
266 if (ret != 0) {
267 LOG(WARNING) << "unload background dict failed";
268 }
269
270 VirtualDict* bg_dict = create_dict();
271
272 if (!bg_dict) {
273 LOG(ERROR) << "create Dict failed";
274 return -1;
275 }
276
277 _status = Status::F_LOADING;
278 if (_dict[_dict_idx]) {
279 bg_dict->set_base_dict(_dict[_dict_idx]);
280 LOG(INFO) << "set base dict from current dict " << _dict_idx;
281 }
282
283 if (_dict_split > 1) {
284 ret = bg_dict->load(_dict_set_path, _in_mem, v_path);
285 } else {
286 ret = bg_dict->load(_dict_path, _in_mem, v_path);
287 }
288 _status = Status::F_RUNNING;
289 if (ret != 0) {
290 LOG(WARNING) << "load background dict failed";
291 delete bg_dict;
292 bg_dict = NULL;
293 return ret;
294 } else {
295 LOG(INFO) << "load background dict succ";
296 set_bg_dict(bg_dict);
297 }
298 return ret;
299}
300
301int Framework::bg_unload() {
302 VirtualDict* bg_dict = get_bg_dict();

Callers 1

handle_bg_load_patchMethod · 0.80

Calls 2

set_base_dictMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected