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

The error asyncio.exceptions.CancelledError occurred while parsing the CSV. #671

Open
kivdev opened this issue Sep 17, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@kivdev
Copy link

kivdev commented Sep 17, 2024

Specifications

  • Client Version: 1.46.0
  • InfluxDB Version: 1.8.10
  • Platform: Debian (docker)

Code sample to reproduce problem

async with InfluxDBClientAsync(url="http://localhost:8086", token="my-token", org="my-org") as client:
        # Stream of FluxRecords
        query_api = client.query_api()
        records = await query_api.query_stream(
        (
            'from(bucket:"{bucket}") |> range(start: {start}, stop: {stop})'
            '|> filter(fn: (r) => r["_measurement"] == "{measurement}")'
            '|> filter(fn: (r) => r.name == "{metric}")'
        ).format(
            bucket='metrics', start='2023-01-01T00:00:00Z', stop='2023-12-31T23:59:59Z', metric='http_request_total_count', measurement='http')
        )
        async for record in records:
            print(record)

Expected behavior

Executed without errors.

Actual behavior

File "/app/my_app/service.py", line 51, in get_influxdb_data
    async for record in records:
  File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/flux_csv_parser.py", line 141, in _parse_flux_response_async
    async for csv in self._reader:
  File "/usr/local/lib/python3.11/site-packages/aiocsv/readers.py", line 54, in __anext__
    return await self._parser.__anext__()
asyncio.exceptions.CancelledError

Additional info

The error occurs only if there is a lot of data. (251,395 records with JSON content)

@kivdev kivdev added the bug Something isn't working label Sep 17, 2024
@bednar
Copy link
Contributor

bednar commented Sep 25, 2024

Hi @kivdev,

Thank you for reaching out with your issue. To better understand and address the problem you're experiencing, it would be incredibly helpful if you could share an example of how your data looks. An anonymized export from the InfluxDB UI would be ideal.

This information will allow us to accurately simulate your scenario and work towards a resolution.

Thanks a lot for your cooperation. Looking forward to your response.

Best Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants