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

[ENH]: Improve tenant and DB validation handling #1494

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

tazarov
Copy link
Contributor

@tazarov tazarov commented Dec 11, 2023

Ref: #1480

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Validation checks are lazily evaluated at first call
    • Proper errors on connectivity issues (including proxying)
    • Added a generic error wrapper for generic server message
    • Client/Sever compatibility check with proper message
    • Fixed an issue with generic JSON errors - they need to match Chroma format with Error type and error message
    • Cleaned up collection add unnecessary try/except
    • Fixed unit mock tests to pass

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python

Documentation Changes

N/A

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readbility, Modularity, Intuitiveness)

)
if ex.response.status_code == 404:
raise ValueError(
f"It appears your Chroma server is running an older version of Chroma {self.get_version()}. "
Copy link
Collaborator

Choose a reason for hiding this comment

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

This error message could be a bit confusing, its only printing the client version right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I see, its saying the validation routes don't exist, maybe we can make that clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now it looks like this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tazarov/experiments/chroma-experiments/oss/1480-better-tenant-db-validation/chromadb/__init__.py", line 182, in HttpClient
    return ClientCreator(tenant=tenant, database=database, settings=settings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tazarov/experiments/chroma-experiments/oss/1480-better-tenant-db-validation/chromadb/api/client.py", line 148, in __init__
    self._validate_tenant_database(tenant=tenant, database=database)
  File "/Users/tazarov/experiments/chroma-experiments/oss/1480-better-tenant-db-validation/chromadb/api/client.py", line 444, in _validate_tenant_database
    raise ValueError(
ValueError: It appears you are using newer version of Chroma client (v0.4.18) that is not compatible with  Chroma server (v0.4.12). Please upgrade your server to the latest version.

try:
resp.raise_for_status()
except requests.HTTPError:
raise (Exception(resp.text))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed wrapping specific error (HTTP) into a generic Exception wrapper.

- Fixed an issue with generic JSON errors - they need to match Chroma format with Error type and error message
- Cleaned up collection add unnecessary try/except
- Fixed unit mock tests to pass

Refs: chroma-core#1480
@tazarov tazarov marked this pull request as ready for review December 15, 2023 21:27
@tazarov tazarov mentioned this pull request Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants