-
Notifications
You must be signed in to change notification settings - Fork 36
Description
System information (please complete the following information):
- OS: Debian GNU/Linux 12 (bookworm)
- Python Version: 3.12.7
- SDK Version: 7.64.7
Error occurred around 2024-11-07 19:07:02 UTC
Describe the bug
In the SDK, specifically within the DatapointsSubscriptionAPI.iterate_data method, there appears to be an unhandled StopIteration exception. This exception is likely triggered by an unprotected next(iterator) call, where the iterator is exhausted without providing a default value or proper handling of the StopIteration exception. As a result, Python raises a RuntimeError when the exception propagates to the generator function. Unfortunately, I do not have the complete stack trace at this time, but I have implemented logging to capture it if the issue reoccurs.
To Reproduce
Run this for long enough
from cognite.client import CogniteClient
client = CogniteClient()
for batch in client.time_series.subscriptions.iterate_data("my_subscription"):
# Do work. Will at some point get excepted by a `RuntimeError: generator raised StopIteration`
Expected behavior
StopIteration to be caught and properly handled by the SDK instead of propagating to the user.
Additional context
Dataset ID and Subscription External ID can be provided upon request