cohorts icon indicating copy to clipboard operation
cohorts copied to clipboard

progress reporting often prints multiple lines

Open jburos opened this issue 7 years ago • 2 comments

Often, tqdm prints progress bars on multiple lines and it can be annoying to scroll through.

This can happen in a trivial fashion, where there is occasionally a single line break in the middle of the progress reporting:

screen shot 2017-05-18 at 2 10 00 pm

You will notice in this case that there is a new linebreak for each warning / info or print statement. Depending on your perspective, this might be an annoyance (bug), or a feature (to alert you to how frequently the warnings occur and/or for which records).

But we are also seeing another, more obviously incorrect scenario where each new update to the progress prints on a new line. Here is an example using the same cohort as above but a different summary function.

screen shot 2017-05-18 at 2 11 29 pm

(here shown with output truncated, for obvious reasons).

My first hypothesis about this bug is that there is some output being printed from somewhere to stdout, so that the phenomenon observed for the first case is simply repeated each time the count function is called, but is producing no output.

There may be something else, but this is my starting assumption. If this is the case, then there might be several underlying causes any one of which is sufficient to yield the behavior noted above.

At any rate, I'm going to investigate the scenario noted above & perhaps this will shed some light on what gives rise to this behavior.

jburos avatar May 18 '17 17:05 jburos

I'm getting a warning message in some of our projects that No handlers could be found for logger: "x.tcga_data". I wonder if this is related to the problems printing progress using tqdm?

jburos avatar May 18 '17 17:05 jburos

In the above example, the problem was resolved by my adding the following two lines before running the second example above:

import logging
logging.basicConfig()

In that case, the function used cohorts.utils.get_logger to initialize the logger & so was able to skip basic configuration. We should probably be clear about the utility of get_logger to minimize this risk.

jburos avatar May 18 '17 19:05 jburos