Skip to content

Commit

Permalink
Fix list gridpool orders (#37)
Browse files Browse the repository at this point in the history
Log the error if a grid pool order detail cannot be converted from the
protobuf message to the OrderDetail object. But continue processing the
other order details.
  • Loading branch information
daniel-zullo-frequenz authored Aug 23, 2024
2 parents 0f33776 + 43330a9 commit 4df3ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
14 changes: 1 addition & 13 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# Frequenz Electricity Trading API Client Release Notes

## Summary

<!-- Here goes a general summary of what this release is about -->

## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
- Fixed list gridpool orders to log an error when an order conversion from protobuf failed and continuing to process other orders.
15 changes: 11 additions & 4 deletions src/frequenz/client/electricity_trading/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,17 @@ async def list_gridpool_orders( # pylint: disable=too-many-arguments
),
)

return [
OrderDetail.from_pb(order_detail)
for order_detail in response.order_details
]
orders: list[OrderDetail] = []
for order_detail in response.order_details:
try:
orders.append(OrderDetail.from_pb(order_detail))
except InvalidOperation:
_logger.error(
"Failed to convert order details for order: %s",
str(order_detail).replace("\n", ""),
)

return orders
except grpc.RpcError as e:
_logger.exception("Error occurred while listing gridpool orders: %s", e)
raise e
Expand Down

0 comments on commit 4df3ee2

Please sign in to comment.