-
Notifications
You must be signed in to change notification settings - Fork 27
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
test_organize_nwb_test_data started to take longer? #191
Comments
I can reproduce the several seconds of nothing, and it appears to be due to |
THANK YOU for digging into it if I defer import of pynwb into Some additional blurboh - may be it is busy serializing/pickling to pass into subprocesses... and may be we got some heavy thing bound somewhere... I tried to py-spy it but it blew up...
In DataLad I usually end up just reassigning handlers from datalad if I want some 3rd party module to log... tried here but it lead to the opposite effect. Setting root logger to DEBUG though worked. That is the patch
and what I saw was:
here it was just 5 not 9 seconds (may be 0.6.0 got faster? ;)), but still awhile -- so it took 3.5 seconds to start subprocess?! those VERY long lists of modules in each subprocess, I hope they are not really reimported again and just reported to be imported at that point ... then there is an additional 1.5 sec at the end before calling memoized which is not accounted for... But overall I now question my initial assessment that I have not experienced that slow operation before... may be later I will try to time travel into original dates when I introduced parallelization there and see if I could avoid seeing the effect... By a quick downgrade of pynwb alone I do get leaner "imports profile" but overall "quality" is comparable. |
I would need to compare on some real use case (dataset) where we would actually need to load metadata (so there would be no cache) to see how it compares to multiprocessing approach but as for the tests diff --git a/dandi/cli/cmd_organize.py b/dandi/cli/cmd_organize.py
index 2424bcd..8c0d2e4 100644
--- a/dandi/cli/cmd_organize.py
+++ b/dandi/cli/cmd_organize.py
@@ -182,7 +182,7 @@ def organize(
# to no benefit from Parallel without using multiproc! But that would
# complicate progress bar indication... TODO
metadata = list(
- Parallel(n_jobs=-1, verbose=10)(
+ Parallel(n_jobs=-1, verbose=10, backend="threading")(
delayed(_get_metadata)(path) for path in paths
)
) makes those tests run in 10-12 instead of 47 seconds ... we could have exposed type of parallelization as an option, but I think that would be overkill. edit: comment in the code says that it is CPU intensive so parallelization for the cases where there is no cached metadata -- would better be done via parallel processes. We could make it "smarter" by exposing interface to query the cache on which ones would need to be really computed, and then invoke Parallel only on those. But it would need some kind of a helper shim on top of Parallel (e.g. |
didn't bother anyone in awhile, might reopen if becomes pertinent again |
Didn't test/time yet, but they (perceptually) started to take longish time, whenever AFAIK they should be speedy as long as the metadata reading is cached etc (... my suspicion that caching of
get_metadata
etc is no longer in effect somehow. Happens even if I roll back to e.g.tags/0.5.0~1
. In the log I seeso it is doing smth for 9 seconds, although then says that it does reuse cached
get_metadata
from the previous test in the matrix... so the question is what is it doing and either it could be avoided.The text was updated successfully, but these errors were encountered: