I have a huge list that I need to process, which takes some time, so I divide it into 4 parts and a multiprocessor each piece with some function. It still takes a little time to work with 4 cores, so I decided that I would add some progress indicator so that it could tell me where each processor is located when processing the list.
My dream was to have something like this:
erasing close atoms, cpu0 [######..............................] 13% erasing close atoms, cpu1 [#######.............................] 15% erasing close atoms, cpu2 [######..............................] 13% erasing close atoms, cpu3 [######..............................] 14%
in this case, each rod moves as the cycle progresses in the function. But instead, I get a continuous stream:

etc., filling out my terminal window.
Here is the main python script that calls the function:
from eraseCloseAtoms import * from readPDB import * import multiprocessing as mp from vectorCalc import * prot, cell = readPDB('file') atoms = vectorCalc(cell) output = mp.Queue()
The following is the eraseCloseAtoms() function:
import numpy as np import click def eraseCloseAtoms(protein, atoms, cell, spacing=2, dmin=1.4, output=None): print 'just need to erase close atoms' if dmin > spacing: print 'the spacing needs to be larger than dmin' return grid = [int(cell[0] / spacing), int(cell[1] / spacing), int(cell[2] / spacing)] selected = list(atoms) with click.progressbar(length=len(atoms), label='erasing close atoms') as bar: for i, atom in enumerate(atoms): bar.update(i) erased = False coord = np.array(atom[6]) for ix in [-1, 0, 1]: if erased: break for iy in [-1, 0, 1]: if erased: break for iz in [-1, 0, 1]: if erased: break for j in protein: protCoord = np.array(protein[int(j)][6]) trueDist = getMinDist(protCoord, coord, cell, vectors) if trueDist <= dmin: selected.remove(atom) erased = True break if output is None: return selected else: output.put(selected)