Repository navigation
Support passing custom host for Index operations - #218
Merged
Merged
Conversation
jhamon
approved these changes
Oct 12, 2023
jhamon
left a comment
Collaborator
There was a problem hiding this comment.
I know it's asking for a lot in this situation, but a test case would be great to see here.
Member
Author
I was thinking about that as well, definitely worth getting one added. I'll take a pass. |
Collaborator
|
Looks great, thanks! |
austin-denoble
force-pushed
the
adenoble/spruce-configuration-support
branch
from
October 13, 2023 21:20
68dbc01 to
55acdd5
Compare
1 task done
austin-denoble
added a commit
that referenced
this pull request
Oct 17, 2023
## Problem Previous revision we added some code to apply a custom `host` value to control plane operations: #218 This change caused 404s when calling dataplane operations. The `Configuration._base_path` value was being overwritten by the custom `host` that was provided due to the `Configuration.host` setter: ``` @host.setter def host(self, value): """Fix base path.""" self._base_path = value self.server_index = None ``` https://github.com/pinecone-io/pinecone-python-client/blob/7ff4ed877ac3e97eb557b747a072a84e57764b91/pinecone/core/client/configuration.py#L493 ## Solution The change I made was actually modifying the reference to `Config.OPENAPI_CONFIG` which overwrote things across the board. Instead of operating on the singleton's instance of the config, we can use `copy.deepcopy(Config.OPENAPI_CONFIG)` and use that to construct things before handing it off to `ApiClient` ## Type of Change - [X] Bug fix (non-breaking change which fixes an issue) ## Test Plan Pull this branch down, use the client locally and make sure that dataplane calls work properly without a `host` or with one in the case of supplying a custom control plane URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
We need support for supplying a custom
hostvalue for index operations.Solution
pinecone.init()andConfigalready support the ability to supply a customhost. It didn't seem like it was being passed through to theApiClient:_get_api_instance()inmanage.pyto check for aConfig.CONTROLLER_HOSTvalue, and apply it to theclient_configif so. This will then be used throughout the index operations.manage.py, test settingcontroller_hostand timeout functionality increate_index/delete_index.Type of Change
Test Plan
Pull this branch down and test locally. I validated myself by passing a bogus
hostin and looking over the errors, then passing the properhostviainitto validate it works properly.