I am running a program that works in parallel, utilizing the Pool
object from the multiprocessing module.
What I am trying to do is run a function n number of times in parallel, each having a separate loading %, and I would like it to be updating the percentage for each function without replacing other percentages... example:
f(x):
while x < 0:
print 'For x = {0}, {1}% completed...\r'.format(x, percentage),
And I would run the function multiple times in parallel.
The effect I am trying to achieve is the following, for f(10000000), f(15000000), f(7000000):
For x = 10000000, 43% completed
For x = 15000000, 31% completed
For x = 7000000, 77% completed
And the percentages will be updating in their individual lines without replacing for other values of x, in this function f
which will be running three times at the same time.
I tried using the carriage return '\r' but that replaces every line and just creates a mess.
Thanks for taking the time to read this post! I hope you can tell me.
I am using Python 2.7 but if it can only be achieved with Python 3 I am open to suggestions.