BF: AudioStim.close to not breed ffmpeg processes by moviepy#252
BF: AudioStim.close to not breed ffmpeg processes by moviepy#252yarikoptic wants to merge 2 commits intoPsychoinformaticsLab:masterfrom
Conversation
|
Thanks! One concern though is that without a matching |
|
Oh, and we should probably also do the same thing for |
|
I'll handle it! I'll simply add open() and close() methods for VideoStims and AudioStims. |
|
sorry, just got to the normal keyboard again.
def __enter__(self):
if not self.clip:
self.open()
return self
def __exit__(self, exc_type, exc_value, traceback):
self.close()within the base Stim class (didn't look in detail if all of them have .clip and .open etc) so ppl could use constructs such as with AudioStim('filename') as stim:
stim.dousefulstuff()and do not need to mess around with open/close dance
from pliers import config
config.set_option('cache_transformers', False)but I wonder why caching is enabled (not disabled) by default. Also it might be worth make it so it would cache up to a specified number of transformers, with the oldest used last time kicked out first -- would then scale better for larger use-cases i guess |
|
Thanks for the comments, this is helpful! I agree that implementing Re: caching, the reason it's on by default is that many of the On the topic of caching, we should probably move to disk-based caching--or at least, make that an option. I initially started out using joblib, but there were some issues I couldn't easily resolve that prompted the move to a simpler solution (my vague recollection is it had to do with pickling). |
|
Any update on this, @yarikoptic @caravanuden? If you don't have time to get to it, that's fine--@qmac or I can probably get to it soon. Just let us know, as it does seem like a fairly high priority to fix. Thanks! |
|
This looks pretty stale to me. Okay to close? |
|
It was stale but there were no indication here that it was fixed one way or another (it might have been, I do not follow the development) |
|
don't ever change, @yarikoptic |
|
"NEVER!" said Yarik who closed a few dozen stale bugs in DataLad in the past week ;) (in my defense -- to the best of my knowledge they all were either addressed, superseded, or no longer pertinent ;)) |
|
hey, in my defense there's a difference between closing a PR, and closing the issue ;) |
|
Hey - initial description was so rich that I totally missed that it was a PR! Should we convert it to an issue? ;-) or may be there is no issue? Anyways, I guess I was just missing you guys add jumped onto an opportunity for a chat ;-) feel free to re close |
Codecov ReportBase: 75.64% // Head: 75.59% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #252 +/- ##
==========================================
- Coverage 75.64% 75.59% -0.06%
==========================================
Files 65 65
Lines 3876 3880 +4
==========================================
+ Hits 2932 2933 +1
- Misses 944 947 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
As initially enjoyed by @caravanuden while observing "Too many open files" crash message while iterating over the list of audio files with a few hundreds of them in a simple code like:
We had to add the
.close()at the end to prevent breeding of ffmpeg zombies. I am not quite certain why gc didn't pick those up -- something might be holding on to those instances, thus not calling any of the__del__s. (in general in python3 it is not reliable to rely on those -- attributes might disappear before actual content of them thus not being able to close them at all). Overall I was not sure about the life cycle of any object there so this is a minimalistic workaround which worked for us