-
Notifications
You must be signed in to change notification settings - Fork 102
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
re-usable pools for random_op methods #69
Comments
some other suggestions after using this a bit more:
new_func = function(self, other, **kwargs){
return getattr(self, func.__name__)(other, **kwargs)
} (or something like that --completely untested) |
Class methods are not well supported (maybe not supported at all?) across process boundaries because they can't be pickled (as pool.apply() complains). I don't know the details, but basically I found that you can only pass functions. I haven't tested the wrapping of a method in a function as you suggest though . . . Also, class variables do not share state across processes. Importantly, this includes BedTool._TEMPFILES. I was getting all sorts of strange behavior using multiprocessing and pybedtools' existing auto-handling of temp files, and files were not being completely cleaned up. So stats.py was my attempt to address both of these issues by having functions work on instances passed to the process (via the func args) and by being careful about cleaning up tempfiles. Anyway, I agree that something like this would be useful but I think it will take some playing around with. |
Thanks to your suggestions, I made a new, general way of applying any arbitrary BedTool method many times in parallel -- see 3f3673c. Eventually, I'd like to deprecate randomstats and the stuff in stats.py in favor of this since it's 1) a lot cleaner and 2) a lot more general. |
in the end, should look something like this:
The text was updated successfully, but these errors were encountered: