-
Notifications
You must be signed in to change notification settings - Fork 9
/
client.py
43 lines (33 loc) · 881 Bytes
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# a client sample
from augmentation import augPb
from augmentation import augGrpc
from augmentation import CS
from augmentation import SERVER_PORT
import grpc
import time
import numpy as np
import zlib
MAX_MESSAGE_LENGTH = 90000000
channel = grpc.insecure_channel(
'localhost:%d' % SERVER_PORT,
options=[('grpc.max_receive_message_length', MAX_MESSAGE_LENGTH)]
)
stub = augGrpc.DataProviderStub(channel)
empty = augPb.Empty()
# print(stub.GetStatus(empty))
print(stub.Control(CS(sign=CS.START)))
#print(stub.Control(CS(sign = CS.STOP)))
time.sleep(0.5)
exit()
t1 = time.time()
bd = stub.GetTrainData(empty)
batch_size = bd.batch_size
data = np.frombuffer(bd.data, dtype=np.float32)
label = np.frombuffer(bd.label, dtype=np.int32)
print(data.shape)
print(label.shape)
print(lens.shape)
t2 = time.time()
print(t2 - t1)