Skip to content

Only actually use tqdm in verbose mode

This PR works around an apparent bug in (old versions of) tqdm that would cause errors like the following when querying for segments:

Traceback (most recent call last):
  File "/home/duncan.macleod/opt/gwpysoft-2.7/lib/python2.7/site-packages/gwpy/segments/flag.py", line 1601, in populate
    on_error=on_error, **kwargs)
  File "/home/duncan.macleod/opt/gwpysoft-2.7/lib/python2.7/site-packages/gwpy/segments/flag.py", line 1087, in query
    return query_(flags, *args, **kwargs)
  File "/home/duncan.macleod/opt/gwpysoft-2.7/lib/python2.7/site-packages/gwpy/segments/flag.py", line 1241, in query_dqsegdb
    raise result
AttributeError: 'tqdm' object has no attribute 'pos' [H1:DCH-PSL_ISS_OMICRON_SNR_GT_45:1]

I think this has something to do with the fact that both gwpy and tqdm are threading at the same time. This patch modifies gwpy.utils.mp to only create a tqdm progress bar when verbose=True is specified, making it much less likely that this error will occur. This makes the relevant function a little more complex, but much more stable on LDAS.

cc @kentblackburn

Merge request reports