Using generator with process_map crashes, despite passing total
parameter to tqdm_class
#1231
Labels
Projects
Milestone
When using process_map on a generator, it crashes if
len
can't be called. For example:That's a lot, here's the important part:
What's funny about that is that I passed the total parameter to my
tqdm_class
parameter:It makes sense when you look in the code though. There, you find that the
process_map
calls_executor_map
with whatever tqdm_kwargs it gets:And
_executor_map
does:Which crashes.
The fix is probably either:
If there's a
tqdm_class
parameter,_executor_map
should use thetotal
parameter it provides, instead of using the kwarg provided toprocess_map
; orThe documentation should be updated to note that the
total
parameter is a supported argument in theprocess_map
function.I think number 2 is easier (no code change), but number 1 makes more sense because it provides a simpler API for how to set the
total
parameter. You could do a combination of the two also:process_map
, but prefer thetotal
parameter that is passed to thetqdm_class
class, if there is one.Version info:
4.59.0 3.8.8 (default, Mar 12 2021, 19:44:18)
[GCC 8.3.0] linux
The text was updated successfully, but these errors were encountered: