Skip to content

Commit

Permalink
Merge pull request #485 from ChristopherBradley/universe
Browse files Browse the repository at this point in the history
BUG: reordered the warning.warn arguments in parallel.py, fixes #484
  • Loading branch information
GavinHuttley committed Jan 10, 2020
2 parents d121884 + 4f9f749 commit cb50a62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cogent3/util/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ def imap(f, s, max_workers=None, use_mpi=False, if_serial="raise", chunksize=Non
if COMM.Get_attr(MPI.UNIVERSE_SIZE) == 1 and if_serial == "raise":
raise RuntimeError(err_msg)
elif COMM.Get_attr(MPI.UNIVERSE_SIZE) == 1 and if_serial == "warn":
warnings.warn(UserWarning, msg=err_msg)
warnings.warn(err_msg, UserWarning)

max_workers = max_workers or 0

if max_workers > COMM.Get_attr(MPI.UNIVERSE_SIZE):
warnings.warn(
UserWarning, msg="max_workers too large, reducing to UNIVERSE_SIZE-1"
"max_workers too large, reducing to UNIVERSE_SIZE-1", UserWarning
)

max_workers = min(max_workers, COMM.Get_attr(MPI.UNIVERSE_SIZE) - 1)
Expand Down

0 comments on commit cb50a62

Please sign in to comment.