-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch and expose microgrid ID and location #708
Fetch and expose microgrid ID and location #708
Conversation
b8cea7b
to
34bb525
Compare
34bb525
to
11ab845
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way you only need to update the medatada(self)
method to remove the if not microgrid_metadata: return Metadata(...)
and raise a custom error (or let the AioRpcError
bubble up) when the microgrid service catches up.
BTW @tiyash-basu-frequenz when the microgrid service implements this, not getting a metadata object (with the location and microgrid ID) should be an unrecoverable error, right? |
The API will return an error if none of the metadata items is available. We can discuss the behaviour for partially available metadata (e.g., there is a microgrid ID, but no location info). I was thinking about returning an error if the microgrid ID is missing. But if just location is missing, then we should return the metadata object with |
94e5326
to
0f03d5a
Compare
Updated based on comments from Tiyash and Luca |
@tiyash-basu-frequenz we were thinking that for working with the microgrid API itself, the So SDK-wise, I think we'll allow all metadata to be missing regardless of what the microgrid API does. |
Before @daniel-zullo-frequenz reverts the latest changes, @frequenz-floss/python-sdk-team do we agree on this path? ☝️ So basically |
... and vice-versa. IMO the SDK should be use-case agnostic here, and the client-app should decide whether the missing information is an error condition or not. |
2cfdebb
to
3976ccd
Compare
3976ccd
to
13a7b0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one comment
The microgrid metadata is needed to retrieve the ID and location of the microgrid. Signed-off-by: Daniel Zullo <[email protected]>
So far the microgrid metadata is needed to get the ID and the location of the microgrid. The metadata is retrieved from the microgrid API through the gRPC call GetMicrogridMetadata. Signed-off-by: Daniel Zullo <[email protected]>
The ConnectionManager retrieves the metadata at initialization when connecting to the microgrid. Signed-off-by: Daniel Zullo <[email protected]>
Signed-off-by: Daniel Zullo <[email protected]>
Signed-off-by: Daniel Zullo <[email protected]>
Signed-off-by: Daniel Zullo <[email protected]>
13a7b0c
to
d0284c9
Compare
@@ -15,6 +15,7 @@ | |||
from frequenz.api.microgrid import microgrid_pb2 as microgrid_pb | |||
from frequenz.api.microgrid.microgrid_pb2_grpc import MicrogridStub | |||
from frequenz.channels import Broadcast, Receiver, Sender | |||
from google.protobuf.empty_pb2 import Empty # pylint: disable=no-name-in-module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is being used all over the place in the SDK, but if we use this instead, then we don't need the # pylint disable=...
:
from google.protobuf.empty_pb2 import Empty # pylint: disable=no-name-in-module | |
from google.protobuf import .empty_pb2 |
Maybe we can create an issue to change it in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created #774
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not there, but we will need it later, where we say empty_pb2.Empty
, I think it just moves the hint to a different place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think some symbols are dynamically generated and pylint
falis to see them at the import level, but once it is imported it works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked it and Sahas is right, this just moves the pylint error to the place empty_pb2.Empty
is used, so from no-name-in-module
to no-member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I also saw that, I closed #774 as invalid, and it seems pylnt
3 should fix the issue, but a preliminary test didn't work. We'll see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the follow up!
Fixes #265