MS2PIPFeatureGenerator and DeepLCFeatureGenerator, provide a progress callback
Opened this issue · 1 comments
Currently (ms2rescore 3.0.3), MS2PIPFeatureGenerator has some code to provide a progress bar when running in a terminal. It's done using rich.progress.track. DeepLCFeatureGenerator seems to not use it.
When a script using MS2PIPFeatureGenerator is run with stderr and stdout is directed to something that isn't a terminal (e.g. pipe to a file or another process), there's no progress feedback printed. It would be nice to have some mechanism to print simple progress messages instead of a rich progress bar. For example, just provide a lambda argument like:
MS2PIPFeatureGenerator(
progress_callback=lambda percentage, text: print "PROGRESS:{}; {}".format(percentage, text)
)
Pretty much any other way is fine, even sending them as logging.info() messages.
There is actually debug logging that is almost sufficient for what I was looking for. I've done:
logging.getLogger('ms2rescore.feature_generators.deeplc').setLevel(logging.DEBUG)
logging.getLogger('deeplc.deeplc').setLevel(logging.DEBUG)
logging.getLogger('ms2rescore.feature_generators.ms2pip').setLevel(logging.DEBUG)
logging.getLogger('ms2pip.core').setLevel(logging.DEBUG)
And this gives sufficient progress messages from DeepLC (e.g. an ASCII progress bar). Maybe it's sufficient to increment the log level of these messages to INFO?