Skip to content
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

fix: catch CancelledError and TimeoutError and add note about timeout #679

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion influxdb_client/client/flux_csv_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Parsing response from InfluxDB to FluxStructures or DataFrame."""


import asyncio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sync client doesn't include asyncio library. You have to check the type by name... maybe something like:

elif 'DataFrame' in type(record).__name__:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to catch BasicException and then check type. import asyncio removed.

import base64
import codecs
import csv as csv_parser
Expand Down Expand Up @@ -147,6 +147,9 @@ async def _parse_flux_response_async(self):
df = self._prepare_data_frame()
if not self._is_profiler_table(metadata.table):
yield df
except (asyncio.exceptions.CancelledError, asyncio.TimeoutError) as ce:
ce.add_note("Stream cancelled during read. Recommended: Check Influxdb client `timeout` setting.")
raise
finally:
self._close()

Expand Down