Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
b7d9adc1
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 2 年 前同步成功
通知
285
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看板
提交
b7d9adc1
编写于
11月 06, 2020
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add server_check
上级
5173059d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
4 deletion
+19
-4
paddlehub/__init__.py
paddlehub/__init__.py
+1
-0
paddlehub/commands/config.py
paddlehub/commands/config.py
+1
-1
paddlehub/server/__init__.py
paddlehub/server/__init__.py
+14
-3
paddlehub/server/server_source.py
paddlehub/server/server_source.py
+3
-0
未找到文件。
paddlehub/__init__.py
浏览文件 @
b7d9adc1
...
@@ -22,6 +22,7 @@ __version__ = '2.0.0-alpha0'
...
@@ -22,6 +22,7 @@ __version__ = '2.0.0-alpha0'
from
paddlehub.config
import
config
from
paddlehub.config
import
config
from
paddlehub.utils
import
log
,
parser
,
utils
from
paddlehub.utils
import
log
,
parser
,
utils
from
paddlehub.utils.paddlex
import
download
,
ResourceNotFoundError
from
paddlehub.utils.paddlex
import
download
,
ResourceNotFoundError
from
paddlehub.server
import
server_check
from
paddlehub.server.server_source
import
ServerConnectionError
from
paddlehub.server.server_source
import
ServerConnectionError
from
paddlehub.module
import
Module
from
paddlehub.module
import
Module
from
paddlehub.text.bert_tokenizer
import
BertTokenizer
from
paddlehub.text.bert_tokenizer
import
BertTokenizer
...
...
paddlehub/commands/config.py
浏览文件 @
b7d9adc1
...
@@ -51,7 +51,7 @@ class ConfigCommand:
...
@@ -51,7 +51,7 @@ class ConfigCommand:
hubconf
.
reset
()
hubconf
.
reset
()
print
(
hubconf
)
print
(
hubconf
)
elif
arg
.
startswith
(
"server=="
):
elif
arg
.
startswith
(
"server=="
):
hubconf
.
server
_url
=
arg
.
split
(
"=="
)[
1
]
hubconf
.
server
=
arg
.
split
(
"=="
)[
1
]
elif
arg
.
startswith
(
"log.level=="
):
elif
arg
.
startswith
(
"log.level=="
):
hubconf
.
log_level
=
arg
.
split
(
"=="
)[
1
]
hubconf
.
log_level
=
arg
.
split
(
"=="
)[
1
]
elif
arg
.
startswith
(
"log.enable=="
):
elif
arg
.
startswith
(
"log.enable=="
):
...
...
paddlehub/server/__init__.py
浏览文件 @
b7d9adc1
...
@@ -13,6 +13,17 @@
...
@@ -13,6 +13,17 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
from
.server_source
import
ServerSource
from
paddlehub.server.server_source
import
ServerSource
from
.git_source
import
GitSource
from
paddlehub.server.git_source
import
GitSource
from
.server
import
module_server
from
paddlehub.server.server
import
module_server
from
paddlehub.utils
import
log
def
server_check
()
->
bool
:
'''Check whether localhost can access the PaddleHub default server normally.'''
if
module_server
.
get_source_by_key
(
'default_hub_server'
).
is_connected
():
log
.
logger
.
info
(
'Request Hub-Server successfully.'
)
return
True
log
.
logger
.
info
(
'Request Hub-Server unsuccessfully.'
)
return
False
paddlehub/server/server_source.py
浏览文件 @
b7d9adc1
...
@@ -119,6 +119,9 @@ class ServerSource(object):
...
@@ -119,6 +119,9 @@ class ServerSource(object):
except
requests
.
exceptions
.
ConnectionError
as
e
:
except
requests
.
exceptions
.
ConnectionError
as
e
:
raise
ServerConnectionError
(
self
.
_url
)
raise
ServerConnectionError
(
self
.
_url
)
def
is_connected
(
self
):
return
self
.
check
(
self
.
_url
)
@
classmethod
@
classmethod
def
check
(
cls
,
url
:
str
)
->
bool
:
def
check
(
cls
,
url
:
str
)
->
bool
:
'''
'''
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录