提交 504f6d95 编写于 作者: H hj

Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleHub into multimachine

......@@ -283,17 +283,23 @@ class CacheUpdater(threading.Thread):
api_url = srv_utils.uri_path(default_hub_server.get_server_url(),
'search')
cache_path = os.path.join(CACHE_HOME, RESOURCE_LIST_FILE)
if os.path.exists(cache_path):
extra = {
"command": "update_cache",
"mtime": os.stat(cache_path).st_mtime
}
else:
extra = {
"command": "update_cache",
"mtime": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
}
try:
r = srv_utils.hub_request(api_url, payload, extra)
except Exception as err:
pass
if r.get("update_cache", 0) == 1:
with open(cache_path, 'w+') as fp:
yaml.safe_dump({'resource_list': r['data']}, fp)
except Exception as err:
pass
def run(self):
self.update_resource_list_file(self.module, self.version)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册