Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
d74fbdea
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d74fbdea
编写于
6月 25, 2019
作者:
B
BinLong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some exceptional bugs
上级
dd1f132f
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
29 addition
and
10 deletion
+29
-10
paddlehub/commands/hub.py
paddlehub/commands/hub.py
+2
-2
paddlehub/common/hub_server.py
paddlehub/common/hub_server.py
+2
-2
paddlehub/common/server_config.py
paddlehub/common/server_config.py
+9
-1
paddlehub/common/stats.py
paddlehub/common/stats.py
+10
-4
paddlehub/module/manager.py
paddlehub/module/manager.py
+5
-0
paddlehub/version.py
paddlehub/version.py
+1
-1
未找到文件。
paddlehub/commands/hub.py
浏览文件 @
d74fbdea
...
...
@@ -22,13 +22,13 @@ import sys
import
requests
from
paddlehub.common.logger
import
logger
from
paddlehub.common
import
stats
from
paddlehub.commands.base_command
import
BaseCommand
from
paddlehub.commands
import
show
from
paddlehub.commands
import
help
from
paddlehub.commands
import
version
from
paddlehub.commands
import
run
from
paddlehub.commands
import
download
from
paddlehub.commands
import
stats
class
HubCommand
(
BaseCommand
):
...
...
@@ -51,7 +51,7 @@ class HubCommand(BaseCommand):
help
.
command
.
execute
(
argv
)
exit
(
1
)
return
False
stats
.
hub_stat
(
argv
)
stats
.
hub_stat
(
[
'hub'
]
+
argv
)
command
=
BaseCommand
.
command_dict
[
sub_command
]
return
command
.
execute
(
argv
[
1
:])
...
...
paddlehub/common/hub_server.py
浏览文件 @
d74fbdea
...
...
@@ -51,6 +51,7 @@ class HubServer(object):
utils
.
check_url
(
self
.
config
[
'server_url'
])
self
.
server_url
=
self
.
config
[
'server_url'
]
self
.
request
()
self
.
_load_resource_list_file_if_valid
()
def
get_server_url
(
self
):
...
...
@@ -222,11 +223,10 @@ class HubServer(object):
raise
else
:
pass
file_url
=
self
.
config
[
'resource_storage_server_url'
]
+
RESOURCE_LIST_FILE
result
,
tips
,
self
.
resource_list_file
=
default_downloader
.
download_file
(
file_url
,
save_path
=
hub
.
CACHE_HOME
)
file_url
,
save_path
=
hub
.
CACHE_HOME
,
replace
=
True
)
if
not
result
:
return
False
return
True
...
...
paddlehub/common/server_config.py
浏览文件 @
d74fbdea
...
...
@@ -13,8 +13,16 @@
# limitations under the License.
HUB_SERVERS
=
[
"http://gzbh-aip-paddlehub01.gzbh.baidu.com:8889/paddlehub"
]
STAT_SERVERS
=
[
"http://gzbh-aip-paddlehub01.gzbh.baidu.com:8889/paddlehub/stat"
,
"http://gzbh-aip-paddlehub02.gzbh.baidu.com:8889/paddlehub/stat"
]
default_server_config
=
{
"server_url"
:
HUB_SERVERS
,
"resource_storage_server_url"
:
"https://bj.bcebos.com/paddlehub/"
,
"resource_storage_server_url"
:
"https://bj.bcebos.com/paddlehub
-data
/"
,
"debug"
:
False
}
default_stat_config
=
{
"server_list"
:
STAT_SERVERS
}
paddlehub/comm
ands
/stats.py
→
paddlehub/comm
on
/stats.py
浏览文件 @
d74fbdea
...
...
@@ -14,15 +14,21 @@
# limitations under the License.
import
os
import
requests
import
time
from
random
import
randint
,
seed
from
paddlehub
import
version
from
paddlehub.common.server_config
import
default_stat_config
def
get_stat_server
():
stat_srv
=
os
.
environ
.
get
(
'HUB_SERVER_STAT_SRV'
)
if
not
stat_srv
:
stat_srv
=
'http://hub.paddlepaddle.org:8888/paddlehub/stat'
return
stat_srv
seed
(
int
(
time
.
time
()))
stat_env
=
os
.
environ
.
get
(
'HUB_SERVER_STAT_SRV'
)
if
stat_env
:
server_list
=
stat_env
.
split
(
';'
)
else
:
server_list
=
default_stat_config
return
server_list
[
randint
(
0
,
len
(
server_list
)
-
1
)]
def
hub_stat
(
argv
):
...
...
paddlehub/module/manager.py
浏览文件 @
d74fbdea
...
...
@@ -21,6 +21,7 @@ import os
import
shutil
from
paddlehub.common
import
utils
from
paddlehub.common
import
stats
from
paddlehub.common.downloader
import
default_downloader
from
paddlehub.common.dir
import
MODULE_HOME
from
paddlehub.module
import
module_desc_pb2
...
...
@@ -80,6 +81,7 @@ class LocalModuleManager(object):
module_dir
=
self
.
modules_dict
[
module_name
][
0
]
module_tag
=
module_name
if
not
module_version
else
'%s-%s'
%
(
module_name
,
module_version
)
stats
.
hub_stat
([
'installed'
,
module_tag
])
tips
=
"Module %s already installed in %s"
%
(
module_tag
,
module_dir
)
return
True
,
tips
,
self
.
modules_dict
[
module_name
]
...
...
@@ -95,6 +97,7 @@ class LocalModuleManager(object):
tips
=
"Can't find module %s"
%
module_name
if
module_version
:
tips
+=
" with version %s"
%
module_version
stats
.
hub_stat
([
'install fail'
,
module_tag
])
return
False
,
tips
,
None
result
,
tips
,
module_zip_file
=
default_downloader
.
download_file
(
...
...
@@ -116,6 +119,7 @@ class LocalModuleManager(object):
shutil
.
move
(
module_dir
,
save_path
)
module_dir
=
save_path
tips
=
"Successfully installed %s"
%
module_name
stats
.
hub_stat
([
'install'
,
module_name
,
url
])
if
installed_module_version
:
tips
+=
"-%s"
%
installed_module_version
return
True
,
tips
,
(
module_dir
,
installed_module_version
)
...
...
@@ -131,6 +135,7 @@ class LocalModuleManager(object):
1
]:
tips
=
"%s-%s is not installed"
%
(
module_name
,
module_version
)
return
True
,
tips
stats
.
hub_stat
([
'uninstall'
,
module_name
])
tips
=
"Successfully uninstalled %s"
%
module_name
if
module_version
:
tips
+=
'-%s'
%
module_version
...
...
paddlehub/version.py
浏览文件 @
d74fbdea
...
...
@@ -13,5 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
""" PaddleHub version string """
hub_version
=
"0.
5.1
"
hub_version
=
"0.
6.5
"
module_proto_version
=
"1.0.0"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录