Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump version, Merge branch 'parallel-print-fix2'
fixes #285 -> #291 -> #329 fixes #422 fixes #439 fixes #323 fixes #324 fixes #334 fixes #407 fixes #418 related to: - #97 - #143 - #331 - #361 - #384 - #385 - #417
- Loading branch information
Showing
8 changed files
with
291 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from __future__ import print_function | ||
from time import sleep | ||
from tqdm import tqdm | ||
from multiprocessing import Pool, freeze_support, Lock | ||
|
||
|
||
L = list(range(9)) | ||
|
||
|
||
def progresser(n): | ||
interval = 0.001 / (n + 2) | ||
total = 5000 | ||
text = "#{}, est. {:<04.2}s".format(n, interval * total) | ||
for _ in tqdm(range(total), desc=text, position=n): | ||
sleep(interval) | ||
|
||
|
||
if __name__ == '__main__': | ||
freeze_support() # for Windows support | ||
p = Pool(len(L), | ||
initializer=tqdm.set_lock, | ||
initargs=(Lock(),)) | ||
p.map(progresser, L) | ||
print("\n" * (len(L) - 2)) | ||
|
||
# alternatively, on UNIX, just use the default internal lock | ||
p = Pool(len(L)) | ||
p.map(progresser, L) | ||
print("\n" * (len(L) - 2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.