-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core][multiprocessing] Make Pool.imap() and Pool.imap_unordered() throw TypeError on non-iterable/iterator #24237
Comments
Minimal reproducing code:
|
We can do it as part of 2.0 if we decide to do it. |
@jjyao do we have a label tracking items for 2.0? |
@edoakes Not yet. Going to create one. |
Perfect; you can ping me if/when you'd like to make the change. It's fairly trivial: removing a four-line workaround I had to insert to maintain compatibility. |
@simontindemans - if you could share a PR that fixes this it would be very much appreciated. |
We will send a warning in 2.3, raise an exception at 2.4 cc @cadedaniel |
Description
Currently, the Ray implementations of
Pool.imap()
andPool.imap_unordered()
accept arguments of the type(func, iterable)
, whereiterable
can be an actual iterable, an iterator, or a single input. In In the letter case, theIMapIterator
constructor treatsiterable
as[iterable]
. The code implementing this (since this PR, which is functionally identical to previous versions in this regard) is as follows:This behaviour deviates from the core Python implementations of
map
andmultiprocessing.imap
andmultiprocessing.imap_unordered
, which all throw aTypeError
when given a single value asiterable
.As this potentially breaks existing code, this was proposed as an issue to be addressed in a future release here:
Originally posted by @edoakes in #24117 (comment)
Use case
The aim is to have a consistent interface for:
map
multiprocessing
:imap
andimap_unordered
ray.util.multiprocessing
:imap
andimap_unordered
The text was updated successfully, but these errors were encountered: