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

Update the API client to support multithreaded applications #1330

Open
jgadling opened this issue Nov 7, 2024 · 0 comments
Open

Update the API client to support multithreaded applications #1330

jgadling opened this issue Nov 7, 2024 · 0 comments
Labels
client The python client for the graphql service P1 Should have

Comments

@jgadling
Copy link
Contributor

jgadling commented Nov 7, 2024

Right now the API client creates one HTTP transport and one GQL client object for the lifetime of the client object:

https://github.com/chanzuckerberg/cryoet-data-portal/blob/main/client/python/cryoet_data_portal/src/cryoet_data_portal/_client.py#L32-L46

This works fine in single threaded applications, but when the client is embedded in multi-threaded applications, race conditions are invoked against the http transport object, and this causes user applications to fail.

I don't think the libraries we're have any native threading support, but it's worth a few minutes of googling.

Most likely the expectation for this ticket is to update the client to dynamically create a new graphql client and http transport for every request to avoid this problem.

@jgadling jgadling added client The python client for the graphql service P1 Should have labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client The python client for the graphql service P1 Should have
Projects
None yet
Development

No branches or pull requests

1 participant