-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
tqdm to logging #1172
base: master
Are you sure you want to change the base?
tqdm to logging #1172
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1172 +/- ##
==========================================
+ Coverage 89.68% 89.86% +0.18%
==========================================
Files 26 26
Lines 1735 1767 +32
Branches 287 293 +6
==========================================
+ Hits 1556 1588 +32
Misses 133 133
Partials 46 46 |
fixed comma in type hint added logging_tqdm added documentation to class added documentation to README python 2 flake8 also test with default logger isort fixed readme title underline too short improved coverage
@de-code Progress bar update shows up in the new line. Is this expected? |
Yes, that is intentional (except for maybe the last line, not sure why it is logging the same progress twice - could add a check for that). It is passing the progress to the regular logging module. No magic there. On the plus side, in a log file it will also still look sensible. |
I am looking for a solution where my progress bar won't look weird in kubernetes logs, at the same time my progress bar is usually iterating over a million files or so that means this will add lot of lines in my logs. |
I think this is where the What I haven't tested is whether the |
I think @brtasavpatel is referring to duplicating the output: once (normally) to |
I've updated the PR to avoid logging the same message twice (which I think may have happened at the end). Regarding the logging, I think the confusion came from the sleep in #1172 (comment) being the same as (or larger than) In my example I had the sleep set to import logging
from time import sleep
from tqdm.contrib.logging import logging_tqdm
LOG = logging.getLogger(__name__)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
for _ in logging_tqdm(range(10), mininterval=1, logger=LOG):
sleep(0.3) # assume processing one item takes less than mininterval EDIT: the example was wrong (it mixing usage as context manager and iterable) |
Would it be worth having something like a |
Is this still desired? |
I would definitely like this to be added in |
Okay, I merged with master. |
Is this still being worked on? I'd love to have this feature as well for use with logging in Hydra (which uses python's logging stdlib) when I need to check the log files from experiment sweeps. |
Hi @casperdcl just wondering anything should be done from my side in order to get this merged? |
Oh dear, I missed the anniversary of this PR. 🎂 Hi @casperdcl it seems some people are interested in getting this merged. |
I used this code in my project and it works great! I would love to see this merged! |
see #313
implementation of #313 (comment)
/cc @casperdcl