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

Saving clusters takes forever #34

Open
jfgonsalves opened this issue Aug 31, 2022 · 1 comment
Open

Saving clusters takes forever #34

jfgonsalves opened this issue Aug 31, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@jfgonsalves
Copy link

jfgonsalves commented Aug 31, 2022

Not sure if this will be addressed in upcoming split of CytoPy into different tools but saving clusters takes ages.

I'm running on bare metal in a fresh Conda env with a reasonably powerful Core i5. I've run CytoPy on an Apple M1 Mac Mini and have the same issue.

It looks like the the save function is single threaded - looking at top it seems like I've got 1 thread fully loaded and 11 others sitting idle.

I'm a bit confused as to what CytoPy is doing with this function - is it writing to Mongo?

I wonder if there is a way we can split the save function into multiple threads. I'm happy to give it a go but wondering if @burtonrj could comment on feasability? Just briefly skimming the mongo docs it seems like there has been support for concurrency for some time.

@burtonrj
Copy link
Owner

burtonrj commented Aug 31, 2022

Hi @jfgonsalves, it is currently single threaded. Part of the problem is that I use Mongoengine, which registers connections globally (https://mongoengine-odm.readthedocs.io/guide/connecting.html). It was a long time ago now, but if I remember it was giving some horrible warning messages with multiprocessing.

With the new version, I want to have a user-defined config file for connection strings, and connections can be created and destroyed within each child process. This is a big refactor though. I'm very very close to finishing my thesis, so promise this will be getting my attention soon.

@burtonrj burtonrj added the enhancement New feature or request label Aug 31, 2022
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