I have a bootloader function that downloads multiple files in parallel. I use multiprocessing.Pool.map_asyncto load different pieces of the same file. I would like to show the boot status bar. To do this, I need to know the already loaded bytes ( total_bytes_dl).
pool = multiprocessing.Pool(processes)
mapObj = pool.map_async(f, args)
while not mapObj.ready():
status = r"%.2f MB / %.2f MB" % (total_bytes_dl / 1024.0 / 1024.0, filesize / 1024.0 / 1024.0,)
status = status + chr(8)*(len(status)+1)
print status,
time.sleep(0.5)
Is there a way to set a variable that will be used for all these processes and the main process, so each process can add the number of bytes loaded?
iTayb source
share