-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlgorithmSupportClient.py
More file actions
58 lines (53 loc) · 4.38 KB
/
AlgorithmSupportClient.py
File metadata and controls
58 lines (53 loc) · 4.38 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import time
import grpc
from concurrent import futures
from proto import AlgorithmSupport_pb2, AlgorithmSupport_pb2_grpc
if __name__ == "__main__":
channel = grpc.insecure_channel("localhost:50050")
stub = AlgorithmSupport_pb2_grpc.AlgorithmSupportServiceStub(channel)
# # 能耗评估请求
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", serviceType="vm", startTimestamp="1568440031",
# endTimestamp="1568440031", algorithm="regtree"))
# pod 分解相关请求
# res = stub.AlgorithmSupport(
# AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="linpack11", serviceType="pod_e", startTimestamp="1568440021",
# endTimestamp="1568440030", algorithm="regtree"))
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="linpack11", serviceType="pod_e", startTimestamp="1568440021",
# endTimestamp="1568440030", algorithm="direct"))
# # 硬件能耗分解请求
res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", serviceType="hardware",
startTimestamp="1568440021", endTimestamp="1568440022",
algorithm="xgboost"))
# 能耗预测请求
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", startTimestamp="1568294221",
# endTimestamp="1568440030", algorithm="rf",
# serviceType="server"))
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", startTimestamp="1568294221",
# endTimestamp="1568440030", algorithm="lstmx2",
# serviceType="server"))
# res = stub.AlgorithmSupport(
# AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", startTimestamp="1568294221",
# endTimestamp="1568440030", algorithm="tcn",
# serviceType="server"))
# res = stub.AlgorithmSupport(
# AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", startTimestamp="1568294221",
# endTimestamp="1568440030", algorithm="arima",
# serviceType="server"))
# res = stub.AlgorithmSupport(
# AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", startTimestamp="1568294221",
# endTimestamp="1568440030", algorithm="darnn",
# serviceType="server"))
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="compute01", startTimestamp="1568510700", endTimestamp="1568510709", algorithm="empty"))
# # pod 能耗预测
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(entityID="linpack11", startTimestamp="1568440021", endTimestamp="1568440030",
# algorithm="rf", serviceType="pod"))
# # 硬件能耗分解请求
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(serviceType="qos", entityID="compute01",
# startTimestamp="1568294221", endTimestamp="1568294222",
# algorithm="brb"))
# res = stub.AlgorithmSupport(AlgorithmSupport_pb2.AlgorithmSupportRequest(serviceType="dc", entityID="datacenter",
# startTimestamp="1568440167", endTimestamp="1568440168",
# algorithm="membership"))
print(res)