pymc icon indicating copy to clipboard operation
pymc copied to clipboard

ENH: Disable all progress bars

Open JakeSummers opened this issue 1 year ago • 3 comments

Context for the issue:

Currently the progress bars printed by pymc are printed to stdout in my backend service. They often corrupt the structured logs that my service prints.

Right now, I need to go through my code to disable all of the progress bars.

Aka I need to, update from:

pm.sample(samples, random_seed=random_seed)

To:

pm.sample(samples, random_seed=random_seed, progressbar=False)

It would make my code better, if I could do something like:

pm.progress_bar(False)

And that would disable all progress bars in pymc.

This would allow me to make my code easy to use with the backend service we integrate with but also to use in notebooks or IDEs.

Related: https://github.com/fastai/fastprogress/issues/105

JakeSummers avatar Feb 12 '24 21:02 JakeSummers

Welcome Banner] :tada: Welcome to PyMC! :tada: We're really excited to have your input into the project! :sparkling_heart:
If you haven't done so already, please make sure you check out our Contributing Guidelines and Code of Conduct.

welcome[bot] avatar Feb 12 '24 21:02 welcome[bot]

Workaround from: https://github.com/fastai/fastprogress/issues/105#issuecomment-1939645396

It looks like this is possible like this:

import fastprogress.fastprogress
fastprogress.fastprogress.NO_BAR = True

If you also want to disable the output from master_bar.write, you can do this:

def do_nothing(*args):
    pass

fastprogress.fastprogress.WRITER_FN = do_nothing

I wonder if this should be added to pymc's api so that if/when the fastprogress dependency is switched for something else, that we will keep the same structure.

JakeSummers avatar Feb 12 '24 21:02 JakeSummers

Not counting on switching that dependency anytime soon

ricardoV94 avatar Feb 13 '24 05:02 ricardoV94