I am using dask distributed to run many tasks, some of which print some status output. These prints interrupt the progress bar and look ugly.
Minimal example:
from time import sleep
from dask.distributed import Client, progress
def slow_func(n):
sleep(n)
if n % 2:
print('this print interrupts the progress bar')
def run():
client = Client()
futures = client.map(slow_func, range(5))
progress(*futures)
if __name__ == '__main__':
run()
output:
[####### ] | 19% Completed | 0.9sthis print interrupts the progress bar
[######################## ] | 60% Completed | 2.9sthis print interrupts the progress bar
desired:
this print did not interrupt the progress bar
this print did not interrupt the progress bar
[######################## ] | 60% Completed | 2.9s
Any way to do this?
Not to my knowledge, no.