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

Weaviate: Improve connection check #470

Open
hsm207 opened this issue Feb 22, 2024 · 3 comments
Open

Weaviate: Improve connection check #470

hsm207 opened this issue Feb 22, 2024 · 3 comments
Labels
contributions wanted! Looking for external contributions feature request Ideas to improve an integration integration:weaviate

Comments

@hsm207
Copy link
Contributor

hsm207 commented Feb 22, 2024

Is your feature request related to a problem? Please describe.
The current check makes a random call to check if the weaviate server is reachable:

 # Test connection, it will raise an exception if it fails.
        self._client.schema.get()

Describe the solution you'd like
Encapsulate the client creation in a method that also does exception handling and prints user friendly messages when an exception is raised. For example (credit to @Shah91n):

def establish_connection():
    
    try:
        client = weaviate.connect_to_wcs(
            cluster_url="",
            auth_credentials=weaviate.auth.AuthApiKey(""),
            headers={"X-OpenAI-Api-Key": ""}
        )

        ready = client.is_ready()
        version = weaviate.__version__
        print(f"Weaviate client is ready: {ready}")
        print(f"Weaviate Version: {version}")
        
return client

    except Exception as e:
        print(f"There is a problem: {e}")
        traceback.print_exc()
        return None

Describe alternatives you've considered
do nothing

Additional context
NA

@hsm207 hsm207 added the feature request Ideas to improve an integration label Feb 22, 2024
@masci masci added the contributions wanted! Looking for external contributions label Mar 22, 2024
@srini047
Copy link

srini047 commented May 4, 2024

Hi, @hsm207 I would like to take up this issue.

@hsm207
Copy link
Contributor Author

hsm207 commented May 4, 2024

Hi @srini047,

Great! Thanks for volunteering. I'm not a maintainer so I can't assign this issue to you. Maybe @masci can?

@srini047
Copy link

Hi @hsm207 , I see this issue outdated considering weaviate now automatically handles the connection persistence and its incorporated in haystack-integrations/integrations/weaviate/src/haystack_integrations/document_stores/weaviate/document_store.py.

But now the issue lies with closing connection, where resources are not freed up. So I would like to extend this issue to address that and contribute the same. This requires handling at the object destructor scope to ensure proper management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions wanted! Looking for external contributions feature request Ideas to improve an integration integration:weaviate
Projects
Development

No branches or pull requests

3 participants