moved cpu usage to a grpc call that the gui will listen to, fixed grpc stream typing to be grpc.Future, fixed pygui issue for start callback when a start fails, but there are no exceptions

This commit is contained in:
Blake Harnden 2020-07-23 09:41:39 -07:00
parent 3544d00431
commit fff4bd7963
7 changed files with 85 additions and 47 deletions

View file

@ -681,6 +681,15 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
last_stats = stats
time.sleep(delay)
def CpuUsage(
self, request: core_pb2.CpuUsageRequest, context: ServicerContext
) -> None:
cpu_usage = grpcutils.CpuUsage()
while self._is_running(context):
usage = cpu_usage.run()
yield core_pb2.CpuUsageEvent(usage=usage)
time.sleep(request.delay)
def AddNode(
self, request: core_pb2.AddNodeRequest, context: ServicerContext
) -> core_pb2.AddNodeResponse: