提交 6712d604 编写于 作者: B bjjwwang

Merge branch 'develop' of https://github.com/paddlepaddle/serving into develop

...@@ -30,6 +30,7 @@ def single_func(idx, resource): ...@@ -30,6 +30,7 @@ def single_func(idx, resource):
paddle.dataset.uci_housing.train(), buf_size=500), paddle.dataset.uci_housing.train(), buf_size=500),
batch_size=1) batch_size=1)
total_number = sum(1 for _ in train_reader()) total_number = sum(1 for _ in train_reader())
latency_list = []
if args.request == "rpc": if args.request == "rpc":
client = Client() client = Client()
...@@ -37,9 +38,12 @@ def single_func(idx, resource): ...@@ -37,9 +38,12 @@ def single_func(idx, resource):
client.connect([args.endpoint]) client.connect([args.endpoint])
start = time.time() start = time.time()
for data in train_reader(): for data in train_reader():
l_start = time.time()
fetch_map = client.predict(feed={"x": data[0][0]}, fetch=["price"]) fetch_map = client.predict(feed={"x": data[0][0]}, fetch=["price"])
l_end = time.time()
latency_list.append(l_end * 1000 - l_start * 1000)
end = time.time() end = time.time()
return [[end - start], [total_number]] return [[end - start], latency_list, [total_number]]
elif args.request == "http": elif args.request == "http":
train_reader = paddle.batch( train_reader = paddle.batch(
paddle.reader.shuffle( paddle.reader.shuffle(
...@@ -47,11 +51,14 @@ def single_func(idx, resource): ...@@ -47,11 +51,14 @@ def single_func(idx, resource):
batch_size=1) batch_size=1)
start = time.time() start = time.time()
for data in train_reader(): for data in train_reader():
l_start = time.time()
r = requests.post( r = requests.post(
'http://{}/uci/prediction'.format(args.endpoint), 'http://{}/uci/prediction'.format(args.endpoint),
data={"x": data[0]}) data={"x": data[0]})
l_end = time.time()
latency_list.append(l_end * 1000 - l_start * 1000)
end = time.time() end = time.time()
return [[end - start], [total_number]] return [[end - start], latency_list, [total_number]]
start = time.time() start = time.time()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册