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

Multithreaded database query #36

Open
valentynbez opened this issue Jun 2, 2023 · 0 comments
Open

Multithreaded database query #36

valentynbez opened this issue Jun 2, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@valentynbez
Copy link

valentynbez commented Jun 2, 2023

Hello!
I use Python foldcomp interface.
Sometimes I need to retrieve 10k structures from a DB. As for now, I can only do it one by one in a for loop. Could this be sped up using multithreading somehow?
Thanks!

EDIT: I guess I solved it this way, querying db doesn't take much RAM

import foldcomp 
from multiprocess import Pool

def retrieve_structure(idx, afdb):
    with foldcomp.open(afdb, ids=[idx]) as db:
        for i, pdb in db:
            structure = pdb 
    return structure

with Pool(2) as p:
    structures = p.map(retrieve_structure, ids)
@khb7840 khb7840 added the enhancement New feature or request label Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants