Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
7f3cfbce
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7f3cfbce
编写于
11月 14, 2019
作者:
W
wangguibao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Elastic CTR
上级
e561855c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
6 addition
and
5 deletion
+6
-5
elastic-ctr/client/api/python/elasticctr/elastic_ctr_api.py
elastic-ctr/client/api/python/elasticctr/elastic_ctr_api.py
+6
-5
未找到文件。
elastic-ctr/client/api/python/elasticctr/elastic_ctr_api.py
浏览文件 @
7f3cfbce
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
# 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
__future__
import
print_function
import
json
import
json
import
sys
import
sys
import
os
import
os
...
@@ -30,7 +31,7 @@ class ElasticCTRAPI(object):
...
@@ -30,7 +31,7 @@ class ElasticCTRAPI(object):
def
read_slots_conf
(
self
,
slots_conf_file
):
def
read_slots_conf
(
self
,
slots_conf_file
):
if
not
os
.
path
.
exists
(
slots_conf_file
):
if
not
os
.
path
.
exists
(
slots_conf_file
):
print
"Path %s not exist"
%
sltos_conf_file
print
(
"Path %s not exist"
%
sltos_conf_file
)
return
-
1
return
-
1
with
open
(
slots_conf_file
,
"r"
)
as
f
:
with
open
(
slots_conf_file
,
"r"
)
as
f
:
for
line
in
f
:
for
line
in
f
:
...
@@ -51,11 +52,11 @@ class ElasticCTRAPI(object):
...
@@ -51,11 +52,11 @@ class ElasticCTRAPI(object):
def
add_slot
(
self
,
instance
,
slot
,
feasigns
):
def
add_slot
(
self
,
instance
,
slot
,
feasigns
):
if
not
isinstance
(
instance
,
list
):
if
not
isinstance
(
instance
,
list
):
print
"add slot: parameter invalid: instance should be list"
print
(
"add slot: parameter invalid: instance should be list"
)
return
-
1
return
-
1
if
not
isinstance
(
feasigns
,
list
):
if
not
isinstance
(
feasigns
,
list
):
print
"add slot: value format invalid: feasigns should be list"
print
(
"add slot: value format invalid: feasigns should be list"
)
return
-
1
return
-
1
kv
=
[{
"slot_name"
:
slot
,
"feasigns"
:
feasigns
}]
kv
=
[{
"slot_name"
:
slot
,
"feasigns"
:
feasigns
}]
...
@@ -82,7 +83,7 @@ class ElasticCTRAPI(object):
...
@@ -82,7 +83,7 @@ class ElasticCTRAPI(object):
response
=
self
.
_conn
.
getresponse
()
response
=
self
.
_conn
.
getresponse
()
return
response
.
read
()
return
response
.
read
()
except
httplib
.
HTTPException
as
e
:
except
httplib
.
HTTPException
as
e
:
print
e
.
reason
print
(
e
.
reason
)
elif
sys
.
version_info
[
0
]
==
3
:
elif
sys
.
version_info
[
0
]
==
3
:
try
:
try
:
self
.
_conn
.
request
(
self
.
_conn
.
request
(
...
@@ -91,4 +92,4 @@ class ElasticCTRAPI(object):
...
@@ -91,4 +92,4 @@ class ElasticCTRAPI(object):
response
=
self
.
_conn
.
getresponse
()
response
=
self
.
_conn
.
getresponse
()
return
response
.
read
()
return
response
.
read
()
except
http
.
clinet
.
HTTPException
as
e
:
except
http
.
clinet
.
HTTPException
as
e
:
print
e
.
reason
print
(
e
.
reason
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录