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:
parent
3544d00431
commit
fff4bd7963
7 changed files with 85 additions and 47 deletions
|
@ -467,7 +467,7 @@ class CoreGrpcClient:
|
|||
session_id: int,
|
||||
handler: Callable[[core_pb2.Event], None],
|
||||
events: List[core_pb2.Event] = None,
|
||||
) -> grpc.Channel:
|
||||
) -> grpc.Future:
|
||||
"""
|
||||
Listen for session events.
|
||||
|
||||
|
@ -484,7 +484,7 @@ class CoreGrpcClient:
|
|||
|
||||
def throughputs(
|
||||
self, session_id: int, handler: Callable[[core_pb2.ThroughputsEvent], None]
|
||||
) -> grpc.Channel:
|
||||
) -> grpc.Future:
|
||||
"""
|
||||
Listen for throughput events with information for interfaces and bridges.
|
||||
|
||||
|
@ -498,6 +498,21 @@ class CoreGrpcClient:
|
|||
start_streamer(stream, handler)
|
||||
return stream
|
||||
|
||||
def cpu_usage(
|
||||
self, delay: int, handler: Callable[[core_pb2.CpuUsageEvent], None]
|
||||
) -> grpc.Future:
|
||||
"""
|
||||
Listen for cpu usage events with the given repeat delay.
|
||||
|
||||
:param delay: delay between receiving events
|
||||
:param handler: handler for every event
|
||||
:return: stream processing events, can be used to cancel stream
|
||||
"""
|
||||
request = core_pb2.CpuUsageRequest(delay=delay)
|
||||
stream = self.stub.CpuUsage(request)
|
||||
start_streamer(stream, handler)
|
||||
return stream
|
||||
|
||||
def add_node(
|
||||
self, session_id: int, node: core_pb2.Node, source: str = None
|
||||
) -> core_pb2.AddNodeResponse:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue