@@ -118,11 +118,12 @@ async def get_microgrid_info( # noqa: DOC502 (raises ApiClientError indirectly)
118118 most likely a subclass of
119119 [GrpcError][frequenz.client.microgrid.GrpcError].
120120 """
121+ print (f"CALLED get_microgrid_info(): { self .stub .GetMicrogridMetadata = } " )
121122 microgrid = await client .call_stub_method (
122123 self ,
123124 lambda : self .stub .GetMicrogridMetadata (
124125 Empty (),
125- timeout = int ( DEFAULT_GRPC_CALL_TIMEOUT ) ,
126+ timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
126127 ),
127128 method_name = "GetMicrogridMetadata" ,
128129 )
@@ -177,7 +178,7 @@ async def list_components( # noqa: DOC502 (raises ApiClientError indirectly)
177178 component_ids = map (_get_component_id , components ),
178179 categories = map (_get_category_value , categories ),
179180 ),
180- timeout = int ( DEFAULT_GRPC_CALL_TIMEOUT ) ,
181+ timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
181182 ),
182183 method_name = "ListComponents" ,
183184 )
@@ -231,7 +232,7 @@ async def list_connections( # noqa: DOC502 (raises ApiClientError indirectly)
231232 starts = map (_get_component_id , sources ),
232233 ends = map (_get_component_id , destinations ),
233234 ),
234- timeout = int ( DEFAULT_GRPC_CALL_TIMEOUT ) ,
235+ timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
235236 ),
236237 method_name = "ListConnections" ,
237238 )
@@ -307,7 +308,7 @@ async def set_component_power_active( # noqa: DOC502 (raises ApiClientError ind
307308 power = power ,
308309 request_lifetime = lifetime_seconds ,
309310 ),
310- timeout = int ( DEFAULT_GRPC_CALL_TIMEOUT ) ,
311+ timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
311312 ),
312313 method_name = "SetComponentPowerActive" ,
313314 )
@@ -390,7 +391,7 @@ async def set_component_power_reactive( # noqa: DOC502 (raises ApiClientError i
390391 power = power ,
391392 request_lifetime = lifetime_seconds ,
392393 ),
393- timeout = int ( DEFAULT_GRPC_CALL_TIMEOUT ) ,
394+ timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
394395 ),
395396 method_name = "SetComponentPowerReactive" ,
396397 )
@@ -487,7 +488,7 @@ async def add_component_bounds( # noqa: DOC502 (Raises ApiClientError indirectl
487488 ),
488489 ** extra_args ,
489490 ),
490- timeout = int ( DEFAULT_GRPC_CALL_TIMEOUT ) ,
491+ timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
491492 ),
492493 method_name = "AddComponentBounds" ,
493494 )
@@ -498,7 +499,7 @@ async def add_component_bounds( # noqa: DOC502 (Raises ApiClientError indirectl
498499 return None
499500
500501 # noqa: DOC502 (Raises ApiClientError indirectly)
501- async def receive_component_data_samples_stream (
502+ def receive_component_data_samples_stream (
502503 self ,
503504 component : ComponentId | Component ,
504505 metrics : Iterable [Metric | int ],
@@ -532,6 +533,7 @@ async def receive_component_data_samples_stream(
532533 Returns:
533534 The data stream from the component.
534535 """
536+ print (f"CALLED receive_component_data_samples_stream({ component = } , { metrics = } )" )
535537 component_id = _get_component_id (component )
536538 metrics_set = frozenset ([_get_metric_value (m ) for m in metrics ])
537539 key = f"{ component_id } -{ hash (metrics_set )} "
@@ -542,6 +544,23 @@ async def receive_component_data_samples_stream(
542544 create_filter = (
543545 microgrid_pb2 .ReceiveComponentDataStreamRequest .ComponentDataStreamFilter
544546 )
547+ call = self .stub .ReceiveComponentDataStream
548+ # res = self.stub.ReceiveComponentDataStream(
549+ # microgrid_pb2.ReceiveComponentDataStreamRequest(
550+ # component_id=_get_component_id(component),
551+ # filter=create_filter(metrics=metrics_set),
552+ # ),
553+ # timeout=DEFAULT_GRPC_CALL_TIMEOUT,
554+ # )
555+ print (f"Creating new broadcaster for { call = } " )
556+ # result = self.stub.ReceiveComponentDataStream(
557+ # microgrid_pb2.ReceiveComponentDataStreamRequest(
558+ # component_id=_get_component_id(component),
559+ # filter=create_filter(metrics=metrics_set),
560+ # ),
561+ # timeout=DEFAULT_GRPC_CALL_TIMEOUT,
562+ # )
563+ # print(f"STREAM RESULT >>>>> {result=}")
545564 broadcaster = streaming .GrpcStreamBroadcaster (
546565 stream_name ,
547566 lambda : aiter (
@@ -550,7 +569,7 @@ async def receive_component_data_samples_stream(
550569 component_id = _get_component_id (component ),
551570 filter = create_filter (metrics = metrics_set ),
552571 ),
553- timeout = int ( DEFAULT_GRPC_CALL_TIMEOUT ) ,
572+ timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
554573 )
555574 ),
556575 lambda msg : component_data_samples_from_proto (msg .data ),
0 commit comments