Allow silencing the 'Upgrading database` calls
basnijholt opened this issue · 2 comments
I am processing and setting up >100.000 QCoDeS databases concurrently (in 256 threads). Every single time a new database is created I am presented with ≈10 lines like
Upgrading database; v6 -> v7: 0%| | 0/1 [00:00<?, ?it/s]
Eventually the output grew so large it crashed my browser 😅
I see that the progress bar just prints to stdout
Ideally the verboseness of these upgrade should be configurable.
In the meantime, what is the recommended way to capture and trash this output? Just contextlib.redirect_stdout
?
I have tried it with:
import os
import sys
import contextlib
import qcodes as qc
import tempfile
names = tempfile._get_candidate_names()
with open(os.devnull, 'w') as f, contextlib.redirect_stdout(f):
with qc.initialised_database_at(f"/tmp/{next(names)}"):
"Do the things here"
but this gives some tqdm errors :(
Are these new empty databases? It seems to me that the bar is only useful for dbs with existing data where the upgrade can be slow
Yes, here I am initializing new empty databases.
I agree that in this case it is not useful.