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
Allow to turn off tqdm via environment variables #612
Comments
why not use from tqdm import tqdm
import os
for x in tqdm(..., disable=os.environ.get("DISABLE_TQDM", False)):
... |
thats a quick solution, thanks. I would still like the suggestions in #614 |
Summary: This allows tqdm to be turned off, by passing a flag through `infer()` to `_infer()`. I chose this approach of passing through the hierarchy because it should fare well in the future growth of BeanMachine's UX, where the `bool` should probably be replaced with several levels/layers of `verbose`, which might be set/modified at various layers of the inheritance hierarchy. Conversely, this design might be too clunky/bloated because it passes through several layers of wrappers. Please let me know! An alternative approach could be to use some global variable. These are viable suggestions for this approach: tqdm/tqdm#619, tqdm/tqdm#612 Reviewed By: nazanint Differential Revision: D20741860 fbshipit-source-id: 73fbb5fa0543cf8331f6417f175442c482db9246
Thanks for your patience! Just released |
For those coming across this issue, the tl;dr on env var overrides (e.g.
So to apply this knowledge:
|
And just to be clear: |
often I use the same code on my local dev machine and a cluster node. To not mess up the log files I normally turn off tqdm. While this is a simple change in the python code, I think it would actually be more convenient to let tqdm check for environment variables and thereby add some level of system level control over tqdm.
e.g.
TQDM=disabled python run.py
could quickly disable tqdm in any script.This should be easy to implement using
os.environ.get()
. I can compile a PR if you like this proposalread the [known issues]
The text was updated successfully, but these errors were encountered: