opensearch-project / opensearch-py

Python Client for OpenSearch
https://opensearch.org/docs/latest/clients/python/
Apache License 2.0
357 stars 176 forks source link

[BUG] TypeError on calling `parallel_bulk` (v2.4.0) #599

Closed evios closed 12 months ago

evios commented 12 months ago

What is the bug?

TypeError("_process_bulk_chunk() got multiple values for argument 'raise_on_exception'")

How can one reproduce the bug?

call

parallel_bulk(
            self._client,
            actions=self._session_generator(),
            chunk_size=100,
            raise_on_error=False,
            raise_on_exception=False,
            max_chunk_bytes=20 * 1024 * 1024,
            request_timeout=60,
        )

What is your host/environment?

Debian Bullseye

Do you have any additional context?

It was first found in version 2.4.0. ignore_status transferred as 3rd positional argument in _process_bulk_chunk: https://github.com/opensearch-project/opensearch-py/blob/567ede30235bf5168e72cbcbf9f56a875166368a/opensearchpy/helpers/actions.py#L486-L488

but raise_on_exception expected as 3rd positional: https://github.com/opensearch-project/opensearch-py/blob/567ede30235bf5168e72cbcbf9f56a875166368a/opensearchpy/helpers/actions.py#L239-L248

Previous versions did not have it. Version 2.3.2 snippet: https://github.com/opensearch-project/opensearch-py/blob/2f57661ebb7c692142c4667f39ac6a2124620f8d/opensearchpy/helpers/actions.py#L470-L478

dblock commented 12 months ago

Likely a bug that slipped through test coverage :( Care to write a test that reproduces this? Maybe a fix?

dblock commented 12 months ago

Fixed in https://github.com/opensearch-project/opensearch-py/pull/601, appreciate any additional eyes @evios.

evios commented 12 months ago

@dblock thanks for the instant fixing. Sure, will keep an eye on the updated version :)

dblock commented 12 months ago

@evios If you want to try it from HEAD that'd be great.

dblock commented 11 months ago

We've released 2.4.2 with a fix.

evios commented 11 months ago

Thank you, it works smoothly with 2.4.2